/* ============================================================
   DevTools Pro — Premium Mobile-First Design System
   ============================================================ */

/* Google Font - Inter */
/* @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap'); */

/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */
:root {
    /* Font */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Light Mode Palette */
    --bg: #f2f2f7;
    --surface: #ffffff;
    --surface-2: rgba(255, 255, 255, 0.72);
    --surface-elevated: #ffffff;
    --border: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.12);

    --text-primary: #1c1c1e;
    --text-secondary: #48484a;
    --text-tertiary: #5c5c60;

    --accent: #005cbf;
    --accent-hover: #004a9e;
    --accent-soft: rgba(0, 92, 191, 0.1);
    --accent-glow: rgba(0, 92, 191, 0.22);

    --destructive: #cc2929;
    --success: #1e7e34;
    --warning: #d39e00;

    --btn-text: #ffffff;

    /* Shadows */
    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.07);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.10);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.14);

    /* Blur */
    --blur: blur(20px);
    --blur-strong: blur(40px);

    /* Radius */
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
    --radius-pill: 99px;

    /* Spacing */
    --page-pad: 1.1rem;
    --nav-h: 60px;
    /* mobile top bar height */
    --bottom-nav-h: 72px;
    /* mobile bottom nav height */
}

[data-theme="dark"] {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: rgba(28, 28, 30, 0.72);
    --surface-elevated: #2c2c2e;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);

    --text-primary: #f5f5f7;
    --text-secondary: #c7c7cc;
    --text-tertiary: #aeaeb2;

    --accent: #3b9eff;
    --accent-hover: #6eb6ff;
    --accent-soft: rgba(59, 158, 255, 0.12);
    --accent-glow: rgba(59, 158, 255, 0.25);

    --destructive: #ff6b6b;
    --success: #4ade80;
    --warning: #fbbf24;

    --btn-text: #000000;

    --shadow-xs: 0 1px 4px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.8);
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background-color: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
    transition: background-color 0.35s ease, color 0.35s ease;
    /* Mobile: full page scroll */
    min-height: 100dvh;
    overflow-x: hidden;
}

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

button,
input,
textarea,
select {
    font-family: inherit;
}

img,
svg {
    display: block;
}

/* Scrollbar polish (desktop) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 99px;
}

/* ============================================================
   3. LAYOUT SHELL
   ============================================================ */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100dvh;
}

/* Desktop: sidebar + content side-by-side  */
.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    /* Desktop: fill viewport height, inner scroll */
    height: 100vh;
    overflow-y: auto;
}

/* ============================================================
   4. SIDEBAR (desktop only)
   ============================================================ */
.sidebar {
    width: 258px;
    flex-shrink: 0;
    background-color: var(--surface-2);
    border-right: 1px solid var(--border);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0.875rem 2rem;
    overflow-y: auto;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 200;
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2.25rem;
    padding: 0 0.5rem;
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.sidebar-title .logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 8px;
    color: #fff;
}

.sidebar-title .logo-icon svg {
    width: 18px;
    height: 18px;
}

.sidebar-title .logo-word-pro {
    font-size: 0.75em;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Nav categories */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-category {
    margin-bottom: 1.5rem;
}

.nav-category-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-tertiary);
    padding: 0 0.75rem;
    margin-bottom: 0.4rem;
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.18s ease;
    position: relative;
}

.nav-link .nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-link .nav-icon svg {
    width: 18px;
    height: 18px;
}

.nav-link:hover {
    background: var(--border);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    height: 50%;
    width: 3px;
    background: var(--accent);
    border-radius: 99px;
}

/* Theme toggle */
.theme-toggle {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-xs);
    flex-shrink: 0;
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: rotate(20deg);
}

/* Sidebar overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1500;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ============================================================
   5. MOBILE HEADER (top bar)
   ============================================================ */
.mobile-header {
    display: none;
    /* shown in media query */
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--page-pad);
    height: var(--nav-h);
    background: var(--surface-2);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 900;
    flex-shrink: 0;
}

.mobile-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.mobile-toggle:active {
    background: var(--border);
}

.mobile-toggle svg {
    width: 22px;
    height: 22px;
    stroke-width: 2;
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.mobile-logo .logo-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

/* ============================================================
   6. HERO SECTION
   ============================================================ */
.hero {
    text-align: center;
    padding: 2rem var(--page-pad) 1.5rem;
    max-width: 680px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Eyebrow badge */
.hero-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.28rem 0.75rem;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.9rem;
    border: 1px solid var(--accent-glow);
}

.hero h1 {
    font-size: clamp(1.75rem, 5.5vw, 2.75rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.04em;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

/* Animated gradient word */
.hero-gradient {
    background: linear-gradient(135deg, var(--accent) 0%, #9b66ff 50%, #ff6b9d 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 5s ease infinite;
    display: inline-block;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.hero-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 460px;
    margin-bottom: 1.25rem;
}

/* Feature pills */
.hero-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.badge-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-pill);
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    box-shadow: var(--shadow-xs);
    transition: all 0.2s;
}

.badge-item:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

.badge-icon {
    font-size: 0.95em;
}

/* Search */
.search-container {
    width: 100%;
    max-width: 480px;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
    display: flex;
}

.search-input {
    width: 100%;
    padding: 0.9rem 1.25rem 0.9rem 2.85rem;
    border-radius: var(--radius-pill);
    border: 1.5px solid var(--border);
    background: var(--surface-elevated);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 400;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s ease;
    outline: none;
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow), var(--shadow-sm);
}

/* ============================================================
   7. TOOL GRID (Bento)
   ============================================================ */
#tools-container {
    padding: 0 var(--page-pad) 3rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.1rem;
}

/* ============================================================
   8. TOOL CARDS
   ============================================================ */
.tool-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: var(--shadow-xs);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.3s ease,
        border-color 0.25s ease;
    position: relative;
    overflow: hidden;
}

/* Decorative gradient shimmer on top edge */
.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), #9b66ff);
    opacity: 0;
    transition: opacity 0.3s;
}

.tool-card:hover {
    transform: translateY(-5px) scale(1.01);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.tool-card:hover::before {
    opacity: 1;
}

.tool-card:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-xs);
}

/* Icon blob */
.tool-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.125rem;
    transition: background 0.3s ease, color 0.3s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex-shrink: 0;
}

.tool-icon svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.9;
}

.tool-card:hover .tool-icon {
    background: var(--accent);
    color: #fff;
    transform: scale(1.08) rotate(-4deg);
}

.tool-title {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
    color: var(--text-primary);
}

.tool-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Arrow hint on card */
.tool-card-arrow {
    margin-top: 1rem;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.25s, transform 0.25s;
}

.tool-card:hover .tool-card-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================================
   9. FORMS & INPUTS (Tool Pages)
   ============================================================ */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--surface-elevated);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-control::placeholder {
    color: var(--text-tertiary);
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

textarea.form-control {
    min-height: 140px;
    resize: vertical;
    line-height: 1.6;
}

/* ============================================================
   10. BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all 0.22s cubic-bezier(0.32, 0.72, 0, 1);
    letter-spacing: -0.01em;
    text-decoration: none;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 6px 24px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--border);
    color: var(--text-primary);
}

/* ============================================================
   11. CARDS (tool page containers)
   ============================================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

/* ============================================================
   12. SECTION HEADER (tool pages)
   ============================================================ */
.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}

.section-header .tool-icon {
    margin-bottom: 0;
}

.section-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

/* ============================================================
   13. MOBILE BOTTOM NAV
   ============================================================ */
.mobile-bottom-nav {
    display: none;
    /* shown in media query */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-h);
    background: var(--surface-2);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-top: 1px solid var(--border);
    z-index: 800;
    padding: 0 0.5rem;
    padding-bottom: env(safe-area-inset-bottom, 0);
    align-items: center;
    justify-content: space-around;
    gap: 0;
}

.bnav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    color: var(--text-tertiary);
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    border: none;
    background: none;
    transition: color 0.18s, background 0.18s;
    min-width: 56px;
    text-decoration: none;
}

.bnav-item svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.75;
}

.bnav-item.active {
    color: var(--accent);
}

.bnav-item:active {
    background: var(--accent-soft);
    color: var(--accent);
}

/* ============================================================
   14. RESPONSIVE — MOBILE-FIRST BREAKPOINTS
   ============================================================ */

/* ---- MOBILE (≤ 768px) ---- */
@media (max-width: 768px) {

    body {
        height: auto;
        overflow: auto;
    }

    .app-container {
        flex-direction: column;
    }

    /* Sidebar becomes an off-canvas drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100dvh;
        width: min(80vw, 300px);
        transform: translateX(-110%);
        z-index: 2000;
        border-right: 1px solid var(--border-strong);
        box-shadow: var(--shadow-lg);
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
        padding-top: 1.25rem;
        padding-bottom: 2rem;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Show mobile top bar */
    .mobile-header {
        display: flex;
    }

    /* Hide bottom nav — not used */
    .mobile-bottom-nav {
        display: none;
    }

    /* Main content fills below the top bar */
    .main-content {
        height: auto;
        overflow: visible;
        flex: 1;
    }

    /* HERO */
    .hero {
        padding: 1.75rem var(--page-pad) 1.25rem;
    }

    .hero h1 {
        font-size: clamp(1.6rem, 8vw, 2.25rem);
    }

    .hero-subtitle {
        font-size: 0.88rem;
        margin-bottom: 1.5rem;
    }

    .hero-label {
        font-size: 0.72rem;
    }

    /* Grid: 2 columns on mobile */
    .tool-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    #tools-container {
        padding: 0 var(--page-pad) 1.5rem;
    }

    /* Compact cards on mobile */
    .tool-card {
        padding: 1.1rem 1rem;
        border-radius: var(--radius);
    }

    .tool-icon {
        width: 38px;
        height: 38px;
        border-radius: 10px;
        margin-bottom: 0.875rem;
    }

    .tool-icon svg {
        width: 18px;
        height: 18px;
    }

    .tool-title {
        font-size: 0.87rem;
    }

    .tool-desc {
        font-size: 0.76rem;
    }

    .tool-card-arrow {
        display: none;
    }

    /* Forms */
    .card {
        padding: 1.25rem;
        border-radius: var(--radius);
    }

    .btn {
        padding: 0.8rem 1.25rem;
        font-size: 0.9rem;
    }
}

/* ---- VERY SMALL (≤ 380px) ---- */
@media (max-width: 380px) {
    .tool-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
    }

    .hero h1 {
        font-size: 1.85rem;
    }

    .badge-item {
        font-size: 0.75rem;
        padding: 0.3rem 0.65rem;
    }
}

/* ---- TABLET (769px – 1024px) ---- */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 220px;
        padding: 1.25rem 0.75rem;
    }

    .tool-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}