/* ═══════════════════════════════════════════════
   ToolBolt — Shared Styles
   Fast tools. Zero friction.
   ═══════════════════════════════════════════════ */

/* ── RESET & VARIABLES ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #08090b;
    --surface: #12131a;
    --surface-2: #1a1b25;
    --surface-3: #22232f;
    --border: #2a2b3a;
    --border-light: #35364a;
    --text: #e4e4f0;
    --text-muted: #b4b5cc;
    --text-dim: #9496b0;
    --accent: #6ee7b7;
    --accent-hover: #5dd4a6;
    --accent-dim: rgba(110, 231, 183, 0.08);
    --accent-2: #38bdf8;
    --accent-3: #f59e0b;
    --red: #f87171;
    --green: #6ee7b7;
    --yellow: #fbbf24;
    --purple: #c084fc;
    --blue: #38bdf8;
    --radius: 10px;
    --radius-lg: 14px;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --max-w: 1200px;
    --header-h: 60px;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

/* ── HEADER ── */
.tb-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(8, 9, 11, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    height: var(--header-h);
    overflow: visible;
}

.tb-header-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo */
.tb-logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.02em;
    transition: opacity 0.2s;
    flex-shrink: 0;
}
.tb-logo:hover { opacity: 0.85; }
.tb-logo-bolt { flex-shrink: 0; }
.tb-logo-text { font-weight: 800; }

/* Desktop Nav */
.tb-nav { display: flex; align-items: center; gap: 4px; }
.tb-nav-link {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 8px 16px;
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
}
.tb-nav-link:hover { color: var(--text); background: var(--surface); }
.tb-nav-link.active { color: var(--accent); background: var(--accent-dim); }

/* Mega Menu Dropdown */
.tb-nav-dropdown { position: relative; }
.tb-nav-trigger {
    display: flex; align-items: center; gap: 6px;
    color: var(--text-muted); font-size: 0.85rem; font-family: var(--font);
    padding: 8px 16px; border-radius: 8px; border: none;
    background: none; cursor: pointer;
    transition: color 0.2s, background 0.2s;
}
.tb-nav-trigger:hover { color: var(--text); background: var(--surface); }
.tb-nav-trigger svg { transition: transform 0.2s; }
.tb-nav-dropdown.open .tb-nav-trigger svg { transform: rotate(180deg); }
.tb-nav-dropdown.open .tb-nav-trigger { color: var(--accent); background: var(--accent-dim); }

.tb-mega {
    display: none;
    position: absolute;
    top: 100%;
    right: -120px;
    padding-top: 12px; /* visual gap — but still hoverable */
    z-index: 200;
}
.tb-mega::before {
    /* invisible bridge covers the gap so hover doesn't break */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 12px;
}
.tb-mega-inner-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px 28px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.03);
    min-width: 780px;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s, transform 0.2s;
}
.tb-nav-dropdown.open .tb-mega {
    display: block;
}
.tb-nav-dropdown.open .tb-mega-inner-wrap {
    opacity: 1;
    transform: translateY(0);
}

.tb-mega-inner {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}
.tb-mega-col { display: flex; flex-direction: column; }
.tb-mega-heading {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.tb-mega-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: rgba(110,231,183,0.06);
    border: 1px solid rgba(110,231,183,0.12);
    border-radius: 6px;
    font-size: 0.7rem;
    margin-right: 6px;
    vertical-align: middle;
    position: relative;
    top: -1px;
}
.tb-mega-col a {
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 5px 8px;
    margin: 0 -8px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
}
.tb-mega-col a:hover { color: var(--text); background: rgba(110,231,183,0.06); }
.tb-mega-col a.active { color: var(--accent); }

/* Hamburger Button */
.tb-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    z-index: 110;
}
.tb-hamburger {
    display: flex; flex-direction: column; gap: 5px;
    width: 22px; height: 18px; position: relative;
}
.tb-hamburger span {
    display: block; height: 2px; width: 100%;
    background: var(--text); border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}
.tb-menu-btn.active .tb-hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.tb-menu-btn.active .tb-hamburger span:nth-child(2) { opacity: 0; }
.tb-menu-btn.active .tb-hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile Drawer */
.tb-mobile-menu {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 8px 16px 16px;
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    box-shadow: 0 16px 40px rgba(0,0,0,0.3);
    z-index: 105;
}
.tb-mobile-menu.open { display: block; }

/* Mobile Accordion Groups */
.tb-mob-group { border-bottom: 1px solid var(--border); }
.tb-mob-toggle {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; padding: 14px 8px;
    background: none; border: none;
    color: var(--text); font-family: var(--font);
    font-size: 0.9rem; font-weight: 600;
    cursor: pointer; text-align: left;
}
.tb-mob-toggle svg { color: var(--text-dim); transition: transform 0.25s; flex-shrink: 0; }
.tb-mob-toggle.open svg { transform: rotate(180deg); }
.tb-mob-panel {
    display: none; padding: 0 8px 12px;
}
.tb-mob-panel.open { display: block; }
.tb-mob-panel a {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 8px 12px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.tb-mob-panel a:hover { color: var(--text); background: var(--surface); }
.tb-mob-panel a.active { color: var(--accent); }

/* Mobile bottom links */
.tb-mob-bottom {
    display: flex; gap: 0; padding: 12px 0 4px;
}
.tb-mob-link {
    color: var(--text-dim);
    font-size: 0.82rem;
    padding: 8px 12px;
    border-radius: 6px;
    transition: color 0.15s;
}
.tb-mob-link:hover { color: var(--text); }

/* ── LAYOUT ── */
.tb-page {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 32px 24px 64px;
}

.tb-main {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 32px;
    align-items: start;
}

.tb-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: calc(var(--header-h) + 24px);
}

/* ── AD SLOTS ── */
.tb-ad {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    overflow: hidden;
}
.tb-ad-leaderboard {
    height: 90px;
    max-width: var(--max-w);
    margin: 16px auto;
    padding: 0 24px;
}
.tb-ad-leaderboard .tb-ad { height: 90px; }
.tb-ad-sidebar { height: 250px; width: 100%; }
.tb-ad-content { height: 100px; width: 100%; margin: 24px 0; }

/* ── TOOL HEADER ── */
.tb-tool-header { margin-bottom: 28px; }
.tb-tool-header h1 {
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 8px;
}
.tb-tool-header h1 .hl { color: var(--accent); }
.tb-tool-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 600px;
}

/* ── FORM ELEMENTS ── */
.tb-textarea {
    width: 100%;
    min-height: 260px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
    line-height: 1.7;
    padding: 16px 20px;
    resize: vertical;
    outline: none;
    transition: border-color 0.25s;
}
.tb-textarea:focus { border-color: var(--accent); }
.tb-textarea::placeholder { color: var(--text-dim); }

.tb-textarea-mono {
    font-family: var(--mono);
    font-size: 0.85rem;
    line-height: 1.65;
    tab-size: 2;
}

.tb-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.25s;
}
.tb-input:focus { border-color: var(--accent); }

.tb-select {
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}
.tb-select:focus { border-color: var(--accent); }

/* ── BUTTONS ── */
.tb-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 16px 0;
}

.tb-btn {
    padding: 9px 18px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.84rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.tb-btn:hover { border-color: var(--accent); color: var(--accent); }

.tb-btn-primary {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
    font-weight: 600;
}
.tb-btn-primary:hover { background: var(--accent-hover); color: var(--bg); border-color: var(--accent-hover); }

/* ── STAT CARDS ── */
.tb-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
.tb-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 12px;
    text-align: center;
    transition: border-color 0.3s, transform 0.2s;
}
.tb-stat:hover { border-color: var(--accent); transform: translateY(-1px); }
.tb-stat-value {
    font-family: var(--mono);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--accent);
    line-height: 1.2;
}
.tb-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 4px;
}

/* ── OPTION CHIPS (for case converter, etc.) ── */
.tb-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}
.tb-chip {
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
}
.tb-chip:hover { border-color: var(--accent); color: var(--text); }
.tb-chip.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* ── OUTPUT BOX ── */
.tb-output {
    width: 100%;
    min-height: 120px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.85rem;
    line-height: 1.65;
    padding: 16px 20px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── STATUS BAR ── */
.tb-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 16px;
    font-size: 0.85rem;
}
.tb-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-dim);
    flex-shrink: 0;
}
.tb-status-dot.valid { background: var(--green); box-shadow: 0 0 6px var(--green); }
.tb-status-dot.invalid { background: var(--red); box-shadow: 0 0 6px var(--red); }
.tb-status-text { color: var(--text-muted); }
.tb-status-text.valid { color: var(--green); }
.tb-status-text.invalid { color: var(--red); }
.tb-status-meta { margin-left: auto; font-family: var(--mono); font-size: 0.78rem; color: var(--text-dim); }

/* ── EXTRA STATS ROW ── */
.tb-meta-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 16px 0;
    font-size: 0.84rem;
    color: var(--text-muted);
}
.tb-meta-row strong { color: var(--text); font-family: var(--mono); font-weight: 600; }

/* ── PANELS (split view) ── */
.tb-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.tb-panel-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-bottom: 6px;
    font-weight: 500;
}

/* ── RELATED TOOLS (sidebar) ── */
.tb-related {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}
.tb-related h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-bottom: 14px;
    font-weight: 600;
}
.tb-related-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.88rem;
    transition: all 0.2s;
    margin-bottom: 2px;
}
.tb-related-link:hover { background: var(--surface-2); color: var(--text); }
.tb-related-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border-radius: 6px;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* ── SEO CONTENT / FAQ ── */
.tb-seo {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 48px 24px;
    border-top: 1px solid var(--border);
}
.tb-seo h2 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}
.tb-seo h2 .hl { color: var(--accent); }
.tb-seo > p {
    color: var(--text-muted);
    font-size: 0.92rem;
    max-width: 720px;
    margin-bottom: 12px;
}

.tb-faq {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 24px;
}
.tb-faq-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
}
.tb-faq-item h3 { font-size: 0.9rem; margin-bottom: 6px; font-weight: 600; }
.tb-faq-item p { font-size: 0.84rem; color: var(--text-muted); line-height: 1.55; }

/* ── FOOTER ── */
.tb-footer {
    border-top: 1px solid var(--border);
    padding: 48px 24px 32px;
}
.tb-footer-inner {
    max-width: var(--max-w);
    margin: 0 auto;
}
.tb-footer-grid {
    display: grid;
    grid-template-columns: 1.6fr repeat(6, 1fr);
    gap: 32px;
    margin-bottom: 40px;
}
.tb-footer-brand .tb-logo { margin-bottom: 12px; }
.tb-footer-brand p { color: var(--text-dim); font-size: 0.85rem; max-width: 260px; line-height: 1.5; }

.tb-footer-col h4 {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-bottom: 14px;
    font-weight: 600;
}
.tb-footer-col a {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 3px 0;
    transition: color 0.2s;
}
.tb-footer-col a:hover { color: var(--accent); }

.tb-footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.tb-footer-copy { font-size: 0.78rem; color: var(--text-dim); }
.tb-footer-credit { font-size: 0.78rem; color: var(--text-dim); }
.tb-footer-credit a { color: var(--accent); text-decoration: none; font-weight: 600; transition: opacity 0.2s; }
.tb-footer-credit a:hover { opacity: 0.8; }

/* ── HOMEPAGE ── */
.tb-hero {
    text-align: center;
    padding: 64px 24px 48px;
    max-width: 1100px;
    margin: 0 auto;
}
.tb-hero h1 {
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.15;
    margin-bottom: 16px;
}
.tb-hero h1 .hl { color: var(--accent); }
.tb-hero p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 520px;
    margin: 0 auto 32px;
}

.tb-search-wrap {
    max-width: 480px;
    margin: 0 auto 48px;
    position: relative;
}
.tb-search {
    width: 100%;
    padding: 14px 20px 14px 44px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.25s;
}
.tb-search:focus { border-color: var(--accent); }
.tb-search::placeholder { color: var(--text-dim); }
.tb-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    font-size: 1rem;
}

.tb-categories { margin-bottom: 48px; }
.tb-cat-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-bottom: 16px;
    font-weight: 600;
}

.tb-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.tb-tool-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.2s;
    cursor: pointer;
}
.tb-tool-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.tb-tool-card-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border-radius: 8px;
    font-size: 1rem;
    flex-shrink: 0;
}
.tb-tool-card-text h3 { font-size: 0.88rem; font-weight: 600; line-height: 1.2; }
.tb-tool-card-text p { font-size: 0.75rem; color: var(--text-dim); margin-top: 2px; }

/* ── SYNTAX HIGHLIGHT (JSON) ── */
.hl-key { color: var(--blue); }
.hl-string { color: var(--green); }
.hl-number { color: var(--yellow); }
.hl-boolean { color: var(--purple); }
.hl-null { color: var(--red); }

/* ── RESPONSIVE ── */
@media (max-width: 960px) {
    .tb-main { grid-template-columns: 1fr; }
    .tb-sidebar { position: static; }
    .tb-panels { grid-template-columns: 1fr; }
    .tb-footer-grid { grid-template-columns: repeat(3, 1fr); gap: 28px; }
    .tb-footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
    .tb-hero h1 { font-size: 2rem; }
    .tb-stats { grid-template-columns: repeat(2, 1fr); }
    .tb-faq { grid-template-columns: 1fr; }
    .tb-nav { display: none; }
    .tb-menu-btn { display: block; }
    .tb-footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
    .tb-footer-brand { grid-column: 1 / -1; }
    .tb-footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
    .tb-tool-header h1 { font-size: 1.5rem; }
    .tb-meta-row { flex-direction: column; gap: 6px; }
}

@media (max-width: 480px) {
    .tb-page { padding: 20px 16px 48px; }
    .tb-tools-grid { grid-template-columns: 1fr; }
}
