/* ============================================================
   base64todecode.com - Global Stylesheet
   ============================================================ */

:root {
  --bg: #f7f8fb;
  --bg-alt: #ffffff;
  --text: #1b2330;
  --text-muted: #5b6472;
  --border: #e2e6ed;
  --primary: #2f5dff;
  --primary-dark: #1e3fcc;
  --primary-lt: rgba(47, 93, 255, 0.08);
  --success: #1aa179;
  --error: #e0413f;
  --radius: 10px;
  --shadow: 0 8px 24px rgba(31, 45, 90, 0.06);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #11151c;
  --bg-alt: #1a212c;
  --text: #e7ecf3;
  --text-muted: #9aa6b5;
  --border: #2b3442;
  --primary: #5b82ff;
  --primary-dark: #7c9bff;
  --primary-lt: rgba(91, 130, 255, 0.12);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* ---------------- Layout ---------------- */

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
}

main { display: block; }

/* ---------------- Header ---------------- */

.site-header {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
}

.logo {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.logo span { color: var(--primary); }

.main-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.main-nav a {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}
.main-nav a:hover,
.main-nav a.active { color: var(--primary); text-decoration: none; }

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.theme-toggle:hover { border-color: var(--primary); }

/* ---------------- Hero ---------------- */

.hero {
  padding: 16px 0 6px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.4rem, 3.5vw, 2.1rem);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.hero p {
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto;
  font-size: 0.98rem;
}

.breadcrumbs {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 14px 0 0;
}
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--primary); }

/* ---------------- Tool Card ---------------- */

.tool {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 24px 0;
}

.tool-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.tab-btn {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tab-btn.active {
  background: var(--primary-lt);
  color: var(--primary);
  border-color: var(--primary);
}

.tool textarea {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.92rem;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.tool textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 14px 0 6px;
}
.field-label:first-child { margin-top: 0; }

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

.btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
  opacity: 0.8;
}
.btn.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid currentColor;
  border-color: var(--border) var(--border) var(--border) var(--primary);
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}
.btn-primary.is-loading::after {
  border-color: rgba(255,255,255,0.35) rgba(255,255,255,0.35) rgba(255,255,255,0.35) #fff;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

.msg {
  font-size: 0.85rem;
  font-weight: 600;
  min-height: 1.4em;
  margin-top: 6px;
}
.msg.error { color: var(--error); }
.msg.success { color: var(--success); }

.options-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 4px 0 14px;
}
.options-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* file drop zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 30px 16px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.drop-zone.dragover { border-color: var(--primary); background: var(--primary-lt); }
.drop-zone input { display: none; }

.drop-zone.is-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}
.drop-zone.is-loading::after {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-left: 8px;
  vertical-align: middle;
  border: 2px solid var(--border);
  border-left-color: var(--primary);
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}

.preview-box {
  margin-top: 14px;
  text-align: center;
}
.preview-box img, .preview-box embed {
  max-width: 100%;
  max-height: 360px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* ---------------- Content ---------------- */

.content {
  padding: 10px 0 40px;
}

.content h2 {
  font-size: 1.4rem;
  margin: 36px 0 14px;
  letter-spacing: -0.01em;
}

.content h3 {
  font-size: 1.1rem;
  margin: 22px 0 8px;
}

.content p { color: var(--text-muted); }

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.9rem;
}
.content th, .content td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}
.content th { background: var(--bg-alt); }

.content code {
  background: var(--primary-lt);
  color: var(--primary-dark);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.88em;
}

/* FAQ */
.faq-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
  background: var(--bg-alt);
  overflow: hidden;
}
.faq-q {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 0.96rem;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.faq-q::after {
  content: "+";
  font-size: 1.2rem;
  color: var(--primary);
  flex-shrink: 0;
}
.faq-item.open .faq-q::after { content: "\2212"; }
.faq-a {
  padding: 0 16px;
  max-height: 0;
  overflow: hidden;
  color: var(--text-muted);
  transition: max-height 0.2s ease;
}
.faq-item.open .faq-a { padding-bottom: 14px; }

/* Tool grid (related tools) */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.tool-card {
  display: block;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.15s, transform 0.1s;
}
.tool-card:hover { border-color: var(--primary); transform: translateY(-2px); text-decoration: none; }
.tool-card h3 { margin: 0 0 6px; font-size: 1rem; color: var(--text); }
.tool-card p { margin: 0; font-size: 0.85rem; color: var(--text-muted); }

/* Trust badge */
.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--success);
  background: rgba(26, 161, 121, 0.1);
  padding: 8px 14px;
  border-radius: 8px;
  margin: 14px 0;
}

/* Ad slot */
.ad-slot {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 16px;
  margin: 24px 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------------- Footer ---------------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  margin-top: 40px;
}
.footer-inner {
  padding: 30px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  justify-content: space-between;
}
.footer-col h4 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 10px;
}
.footer-col a {
  display: block;
  color: var(--text);
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 16px 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 640px) {
  .site-header .container { height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; gap: 8px; }
  .main-nav { gap: 10px; flex-wrap: wrap; justify-content: center; width: 100%; order: 2; }
  .main-nav a { font-size: 0.8rem; }
  .tool-tabs { flex-direction: row; }
  .footer-inner { gap: 20px; }
}

/* Visually hidden (a11y) */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
