/* ============================================================
   base64.css — Base64 Encoder / Decoder
   Chedders Tools · Tool-scoped stylesheet
   ============================================================ */

/* ------------------------------------------------------------
   Base
   ------------------------------------------------------------ */
:root {
  --primary: #0b1f3a;
  --primary-light: #16345f;
  --background: #ffffff;
  --surface: #f8f9fa;
  --text: #111111;
  --muted: #6c757d;
  --border: #e5e7eb;
  --shadow: rgba(0, 0, 0, 0.05);
  --error: #dc3545;
}

[data-theme="dark"] {
  --background: #081120;
  --surface: #0f1c2e;
  --text: #ffffff;
  --muted: #b0b7c3;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: rgba(0, 0, 0, 0.3);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', 'Plus Jakarta Sans', 'Manrope', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--background);
  transition: background-color 0.25s ease, color 0.25s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ------------------------------------------------------------
   Layout — Container
   ------------------------------------------------------------ */
.container-xl {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ------------------------------------------------------------
   Navbar
   ------------------------------------------------------------ */
.navbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.navbar .container-xl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.navbar-brand {
  text-decoration: none;
  font-size: 17px;
  line-height: 1;
}

.brand-text {
  font-weight: 700;
  color: var(--primary);
}

[data-theme="dark"] .brand-text {
  color: #ffffff;
}

.brand-dot {
  font-weight: 700;
  color: var(--primary);
}

[data-theme="dark"] .brand-dot {
  color: #ffffff;
}

.brand-tools {
  font-weight: 400;
  color: var(--muted);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-back {
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-back:hover {
  color: var(--primary);
}

[data-theme="dark"] .nav-back:hover {
  color: #ffffff;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  transition: border-color 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--muted);
}

/* ------------------------------------------------------------
   Page Header
   ------------------------------------------------------------ */
.tool-header {
  padding: 40px 0 24px;
  background: var(--background);
  transition: background-color 0.25s ease;
}

.tool-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
  margin-bottom: 0;
}

[data-theme="dark"] .tool-title {
  color: #ffffff;
}

.tool-description {
  font-size: 15px;
  color: var(--muted);
  margin-top: 6px;
  margin-bottom: 0;
}

/* ------------------------------------------------------------
   Tool Container
   ------------------------------------------------------------ */
.tool-main {
  padding: 0 0 80px;
  flex: 1;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 2px 8px var(--shadow);
  max-width: 860px;
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

/* ------------------------------------------------------------
   Inputs
   ------------------------------------------------------------ */
.field-group {
  margin-bottom: 20px;
}

.field-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.tool-textarea {
  width: 100%;
  min-height: 140px;
  resize: vertical;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.6;
  transition: border-color 0.2s ease, background-color 0.25s ease, color 0.25s ease;
  outline: none;
}

.tool-textarea::placeholder {
  color: var(--muted);
}

.tool-textarea:focus {
  border-color: var(--primary);
  outline: 2px solid var(--primary);
  outline-offset: 0;
  box-shadow: none;
}

[data-theme="dark"] .tool-textarea:focus {
  outline-color: rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.4);
}

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.btn-primary-tool {
  background: var(--primary);
  color: #ffffff;
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  line-height: 1.4;
}

.btn-primary-tool:hover {
  background: var(--primary-light);
  border-color: var(--primary-light);
}

.btn-secondary-tool {
  background: var(--background);
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  line-height: 1.4;
}

.btn-secondary-tool:hover {
  background: var(--primary);
  color: #ffffff;
}

[data-theme="dark"] .btn-secondary-tool {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .btn-secondary-tool:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Copy button — compact variant sitting in the output label row */
.btn-copy {
  padding: 6px 16px;
  font-size: 13px;
}

/* ------------------------------------------------------------
   Output
   ------------------------------------------------------------ */
.output-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.output-label-row .field-label {
  margin-bottom: 0;
}

.output-box {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  min-height: 100px;
  transition: background-color 0.25s ease, border-color 0.25s ease;
  position: relative;
  overflow-x: auto;
}

.output-placeholder {
  color: var(--muted);
  font-size: 14px;
}

.output-content {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  display: none;
}

.output-box.has-content .output-placeholder {
  display: none;
}

.output-box.has-content .output-content {
  display: block;
}

/* ------------------------------------------------------------
   Error state
   ------------------------------------------------------------ */
.error-msg {
  font-size: 13px;
  color: var(--error);
  margin-top: 6px;
  min-height: 18px;
}

.output-box.is-error {
  border-color: var(--error);
}

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */
.site-footer {
  padding: 24px 0;
  border-top: 1px solid var(--border);
  background: var(--background);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.footer-text {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin: 0;
}

.footer-text a {
  color: var(--primary);
  text-decoration: none;
}

.footer-text a:hover {
  text-decoration: underline;
}

[data-theme="dark"] .footer-text a {
  color: #a8c4e0;
}

/* ------------------------------------------------------------
   Responsive — Mobile
   ------------------------------------------------------------ */
@media (max-width: 575px) {
  .tool-card {
    padding: 16px;
  }

  .tool-title {
    font-size: 22px;
  }

  .btn-row {
    flex-direction: column;
  }

  .btn-primary-tool,
  .btn-secondary-tool {
    width: 100%;
    text-align: center;
  }

  .output-label-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .btn-copy {
    width: auto;
  }
}
