/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #11A2D7;
  --primary-dark: #0c89b8;
  --secondary: #E94C8A;
  --bg: #f0f4f8;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(17,162,215,.10);
  --shadow-lg: 0 8px 32px rgba(17,162,215,.14);
}
html { scroll-behavior: smooth; }
body { font-family: 'Inter', 'Segoe UI', Arial, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; font-size: 15px; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ===== TOPBAR ===== */
.topbar {
  display: none;
  background: var(--primary-dark);
  color: rgba(255,255,255,.85);
  text-align: center;
  font-size: .78rem;
  padding: .35rem 1rem;
  letter-spacing: .02em;
}
.topbar a { color: #FFD84D; font-weight: 600; }
.topbar a:hover { color: #fff; }

/* ===== HEADER ===== */
.site-header {
  background: linear-gradient(135deg, var(--primary) 0%, #0d89b8 45%, var(--secondary) 100%);
  padding: .75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,.18);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2rem;
}
.site-logo img { display: block; }
.main-nav {
  display: flex;
  gap: .25rem;
  flex-wrap: nowrap;
  align-items: center;
  margin-left: auto;
}
.main-nav a {
  color: rgba(255,255,255,.88);
  font-size: .82rem;
  font-weight: 500;
  padding: .3rem .65rem;
  border-radius: 6px;
  transition: background .18s, color .18s;
  white-space: nowrap;
}
.main-nav a:hover { background: rgba(255,255,255,.15); color: #fff; }

/* ===== HAMBURGER ===== */
.nav-burger {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: .35rem;
  color: #fff;
  border-radius: 6px;
  transition: background .15s;
  flex-shrink: 0;
}
.nav-burger:hover { background: rgba(255,255,255,.15); }

@media (max-width: 768px) {
  .nav-inner { flex-wrap: wrap; gap: .5rem; padding: .6rem 1rem; }
  .nav-burger { display: flex; margin-left: auto; }
  .main-nav {
    display: none;
    flex-direction: column;
    width: 100%;
    order: 10;
    margin-left: 0;
    gap: 0;
    padding-bottom: .4rem;
  }
  .site-header.nav-open .main-nav { display: flex; }
  .main-nav a {
    padding: .65rem .75rem;
    font-size: .92rem;
    border-radius: 6px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    white-space: normal;
  }
  .main-nav a:last-child { border-bottom: none; }
}

/* ===== NAV DROPDOWN ===== */
.nav-dropdown { position: relative; display: inline-flex; align-items: center; }
.nav-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: rgba(255,255,255,.88);
  font-size: .82rem;
  font-weight: 600;
  padding: .3rem .7rem;
  border-radius: 6px;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.22);
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s;
  font-family: inherit;
  line-height: 1.4;
}
.nav-dropdown-btn:hover,
.nav-dropdown.open .nav-dropdown-btn { background: rgba(255,255,255,.3); color: #fff; }
.nav-dropdown-btn .dd-arrow { transition: transform .2s; flex-shrink: 0; }
.nav-dropdown.open .nav-dropdown-btn .dd-arrow { transform: rotate(180deg); }
.nav-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + .55rem);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,.2);
  padding: 1rem 1.2rem;
  display: none;
  gap: 1.25rem;
  min-width: 580px;
  z-index: 500;
}
.nav-dropdown.open .nav-dropdown-menu { display: flex; }
.dropdown-col { flex: 1; min-width: 0; }
.dropdown-group-label {
  font-size: .69rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  padding-bottom: .4rem;
  margin-bottom: .45rem;
  border-bottom: 2px solid var(--border);
}
.nav-dropdown-menu a {
  display: block;
  padding: .28rem .4rem;
  font-size: .81rem;
  color: var(--text);
  background: none;
  border-radius: 5px;
  white-space: nowrap;
  font-weight: 400;
  transition: background .12s, color .12s;
}
.nav-dropdown-menu a:hover { background: var(--bg); color: var(--primary); }
@media (max-width: 768px) {
  .nav-dropdown { display: flex; flex-direction: column; width: 100%; }
  .nav-dropdown-btn {
    width: 100%;
    justify-content: space-between;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,.1);
    border-radius: 0;
    padding: .65rem .75rem;
    font-size: .92rem;
  }
  .nav-dropdown-menu {
    position: static;
    flex-direction: column;
    gap: 0;
    padding: .25rem .75rem .75rem;
    box-shadow: none;
    border-radius: 0;
    background: rgba(0,0,0,.12);
    min-width: 0;
  }
  .dropdown-group-label { color: rgba(255,255,255,.55); border-bottom-color: rgba(255,255,255,.2); margin-top: .6rem; }
  .nav-dropdown-menu a { color: rgba(255,255,255,.85); padding: .45rem .4rem; border-bottom: 1px solid rgba(255,255,255,.08); border-radius: 0; }
  .nav-dropdown-menu a:hover { background: rgba(255,255,255,.1); color: #fff; }
}

/* ===== HERO (compact) ===== */
.page-hero {
  background: linear-gradient(135deg, var(--primary) 0%, #0d89b8 45%, var(--secondary) 100%);
  color: #fff;
  padding: 1.1rem 1.5rem 1.25rem;
  text-align: center;
}
.page-hero h1 { font-size: clamp(1.2rem, 3vw, 1.6rem); font-weight: 800; margin-bottom: .3rem; letter-spacing: -.02em; }
.page-hero p { font-size: .88rem; opacity: .88; max-width: 600px; margin: 0 auto; }
.breadcrumb { display: flex; align-items: center; gap: .4rem; font-size: .78rem; margin-bottom: .5rem; justify-content: center; }
.breadcrumb span { opacity: .6; }

/* ===== CONTAINERS ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.25rem; }
.container-sm { max-width: 860px; margin: 0 auto; padding: 0 1.25rem; }
.container-md { max-width: 980px; margin: 0 auto; padding: 0 1.25rem; }

/* ===== TOOL CARD ===== */
.tool-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  margin: 1.5rem 0;
}
.tool-card-header {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1rem 1.4rem;
  background: linear-gradient(90deg, #f8fbff 0%, #f0f7ff 100%);
  border-bottom: 1px solid var(--border);
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
}
.tool-card-header svg { width: 20px; height: 20px; flex-shrink: 0; stroke: var(--primary); }
.tool-body { padding: 1.25rem 1.4rem 1.5rem; }

/* ===== TEXTAREA ===== */
.textarea-wrap { position: relative; }
textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: .85rem 1rem;
  font-family: 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
  font-size: .88rem;
  line-height: 1.55;
  color: var(--text);
  background: #fafbfc;
  resize: vertical;
  min-height: 180px;
  transition: border-color .2s, box-shadow .2s;
}
textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(17,162,215,.12); background: #fff; }
textarea::placeholder { color: #b0bec5; }
.textarea-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .5rem;
  flex-wrap: wrap;
}
.char-count { font-size: .75rem; color: var(--muted); margin-left: auto; }

/* ===== STATS BAR ===== */
.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: .75rem 0;
}
.stat-chip {
  background: #f0f7ff;
  border: 1px solid #d0e8f7;
  border-radius: 20px;
  padding: .28rem .75rem;
  font-size: .8rem;
  color: var(--primary-dark);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .35rem;
}
.stat-chip span { font-weight: 400; color: var(--muted); }
.stat-chip.accent { background: #fff0f7; border-color: #f7c0d8; color: var(--secondary); }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: .45rem; padding: .6rem 1.2rem; border-radius: 8px; font-size: .88rem; font-weight: 600; cursor: pointer; border: none; transition: all .18s; }
.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: #fff; box-shadow: 0 2px 8px rgba(17,162,215,.3); }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark) 0%, #0a74a0 100%); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(17,162,215,.35); }
.btn-secondary { background: #f0f4f8; color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-accent { background: linear-gradient(135deg, var(--secondary) 0%, #c73870 100%); color: #fff; box-shadow: 0 2px 8px rgba(233,76,138,.25); }
.btn-accent:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(233,76,138,.3); }
.btn-sm { padding: .38rem .8rem; font-size: .8rem; }
.btn-reset { background: transparent; color: var(--muted); border: 1.5px solid var(--border); }
.btn-reset:hover { background: #f8fafc; color: var(--text); }
.btn-copy { background: #f0fff4; color: #16a34a; border: 1.5px solid #bbf7d0; }
.btn-copy:hover { background: #dcfce7; }
.btn-copy.copied { background: #16a34a; color: #fff; border-color: #16a34a; }

/* ===== FORM ELEMENTS ===== */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; font-size: .85rem; color: var(--muted); margin-bottom: .4rem; text-transform: uppercase; letter-spacing: .04em; }
input[type="number"], input[type="text"], select {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: .6rem .9rem;
  font-size: .9rem;
  color: var(--text);
  background: #fafbfc;
  transition: border-color .2s;
}
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(17,162,215,.1); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

/* ===== RADIO / CHECKBOX GROUPS ===== */
.radio-group { display: flex; flex-wrap: wrap; gap: .5rem; }
.radio-btn { display: flex; align-items: center; gap: .4rem; cursor: pointer; }
.radio-btn input { accent-color: var(--primary); }
.radio-btn span { font-size: .88rem; }
.option-group { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.option-chip {
  display: flex; align-items: center; gap: .3rem;
  background: #f0f4f8; border: 1.5px solid var(--border);
  border-radius: 20px; padding: .3rem .75rem;
  font-size: .82rem; cursor: pointer; transition: all .15s;
}
.option-chip:has(input:checked),
.option-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.option-chip input { display: none; }

/* ===== OUTPUT AREA ===== */
.output-area {
  background: #f8fbff;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: .85rem 1rem;
  min-height: 120px;
  font-family: 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
  font-size: .88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text);
  position: relative;
}
.output-area.success { border-color: #86efac; background: #f0fff4; }
.output-area.error { border-color: #fca5a5; background: #fff5f5; color: #dc2626; }
.output-placeholder { color: #b0bec5; font-family: inherit; }

/* ===== TOOL GRID (index page) ===== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: .9rem;
  margin: 1rem 0;
}
.tool-tile {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  border: 1.5px solid var(--border);
  transition: transform .18s, box-shadow .18s, border-color .18s;
  display: block;
  color: var(--text);
}
.tool-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary); color: var(--text); }
.tool-tile-icon { width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); border-radius: 8px; display: flex; align-items: center; justify-content: center; margin-bottom: .6rem; }
.tool-tile-icon svg { width: 18px; height: 18px; stroke: #fff; }
.tool-tile-icon.accent { background: linear-gradient(135deg, var(--secondary) 0%, #c73870 100%); }
.tool-tile-icon.green { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.tool-tile-icon.purple { background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%); }
.tool-tile-icon.orange { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.tool-tile h3 { font-size: .92rem; font-weight: 700; margin-bottom: .25rem; }
.tool-tile p { font-size: .8rem; color: var(--muted); line-height: 1.45; }

/* ===== SECTION / INFO ===== */
.section { margin: 2rem 0; }
.section-title { font-size: 1.25rem; font-weight: 700; color: var(--text); margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem; }
.section-title::after { content: ''; flex: 1; height: 2px; background: linear-gradient(90deg, var(--border) 0%, transparent 100%); }
.info-section { background: var(--surface); border-radius: var(--radius); padding: 1.4rem 1.5rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.info-section h2 { font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: .9rem; display: flex; align-items: center; gap: .5rem; }
.info-section h2 .icon svg { width: 18px; height: 18px; stroke: var(--primary); vertical-align: middle; }
.info-section p { font-size: .9rem; color: var(--muted); line-height: 1.7; margin-bottom: .75rem; }
.info-section ul, .info-section ol { padding-left: 1.25rem; color: var(--muted); font-size: .9rem; line-height: 1.8; }
.info-section li { margin-bottom: .2rem; }
.info-section strong { color: var(--text); }

/* ===== HOW-TO STEPS ===== */
.steps { counter-reset: step; display: flex; flex-direction: column; gap: .85rem; }
.step { display: flex; gap: .9rem; align-items: flex-start; }
.step::before { counter-increment: step; content: counter(step); min-width: 26px; height: 26px; background: var(--primary); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; flex-shrink: 0; margin-top: .1rem; }
.step p { font-size: .9rem; color: var(--muted); line-height: 1.6; }
.step strong { color: var(--text); }

/* ===== FAQ ===== */
.faq-list { display: flex; flex-direction: column; gap: .5rem; }
.faq-item { background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px; overflow: hidden; }
.faq-question {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1.1rem; background: none; border: none; cursor: pointer;
  font-size: .9rem; font-weight: 600; color: var(--text); text-align: left;
  transition: background .15s;
}
.faq-question:hover { background: #f8fafc; }
.faq-question svg { width: 18px; height: 18px; stroke: var(--muted); flex-shrink: 0; transition: transform .2s; }
.faq-item.open .faq-question svg { transform: rotate(180deg); }
.faq-answer { display: none; padding: 0 1.1rem .9rem; font-size: .88rem; color: var(--muted); line-height: 1.7; }
.faq-item.open .faq-answer { display: block; }

/* ===== AD LAYOUT ===== */
.ad-layout {
  display: flex;
  align-items: flex-start;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0;
}
.ad-layout .container-sm { flex: 1; min-width: 0; max-width: 860px; }
.ad-col { width: 160px; flex-shrink: 0; padding: 1.5rem 8px 0; }
.ad-horiz-mob { margin: 1.5rem 0; }
@media (max-width: 1240px) { .ad-layout { display: block; } .ad-col { display: none; } }

/* ===== FOOTER ===== */
.site-footer {
  background: linear-gradient(135deg, var(--primary) 0%, #0d89b8 45%, var(--secondary) 100%);
  color: rgba(255,255,255,.75);
  padding: 3rem 0 1.5rem;
  font-size: .85rem;
  margin-top: 3rem;
}
.footer-grid { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 2rem; margin-bottom: 2rem; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 420px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-logo { font-size: 1.15rem; font-weight: 800; color: #fff; margin-bottom: .5rem; }
.footer-col h4 { font-size: .82rem; font-weight: 700; color: rgba(255,255,255,.9); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .65rem; }
.footer-col a { display: block; color: rgba(255,255,255,.7); font-size: .82rem; margin-bottom: .35rem; transition: color .15s; }
.footer-col a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.2); padding-top: 1.25rem; text-align: center; color: rgba(255,255,255,.55); font-size: .8rem; }

/* ===== ALERTS ===== */
.alert { padding: .75rem 1rem; border-radius: 8px; font-size: .88rem; margin: .75rem 0; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-success { background: #f0fff4; color: #166534; border: 1px solid #86efac; }
.alert-warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ===== KEYBOARD SHORTCUT BADGE ===== */
.kbd { display: inline-block; background: #f0f4f8; border: 1px solid #cbd5e1; border-radius: 4px; padding: .1rem .4rem; font-family: monospace; font-size: .78rem; color: var(--muted); }

/* ===== DIFF / HIGHLIGHT ===== */
.diff-added { background: #d1fae5; color: #065f46; }
.diff-removed { background: #fee2e2; color: #991b1b; text-decoration: line-through; }
mark { background: #fef9c3; color: #854d0e; border-radius: 2px; padding: 0 2px; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ===== CODE TEXTAREA ===== */
.code-textarea {
  font-family: 'JetBrains Mono','Fira Code','Cascadia Code','Consolas',monospace;
  font-size: .82rem;
  line-height: 1.6;
}

/* ===== SAVINGS BOX (minifier tools) ===== */
.savings-box {
  background: linear-gradient(135deg,#f0fff4,#e6f9ed);
  border: 2px solid #a8ddb8;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin: .75rem 0;
}
.savings-stat { text-align: center; }
.savings-stat .val { font-size: 1.6rem; font-weight: 800; color: #1a6b35; line-height: 1.1; }
.savings-stat .lbl { font-size: .75rem; color: #4a8a60; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* ===== FILTER BAR (index page) ===== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 1.25rem 0 .25rem;
}
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem 1rem;
  border-radius: 20px;
  font-size: .83rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  transition: all .18s;
}
.filter-pill:hover { border-color: var(--primary); color: var(--primary); }
.filter-pill.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(17,162,215,.3); }

/* ===== UTILITY ===== */
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.text-muted { color: var(--muted); }
.text-sm { font-size: .85rem; }
.flex { display: flex; } .flex-wrap { flex-wrap: wrap; } .gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
