/* --- 1. MODERN DESIGN TOKENS (V3 Premium) --- */
:root {
    /* Palette: Premium Indigo to Pink Gradient Theme */
    --primary-hue: 250;
    --primary: #4F46E5;
    /* Indigo */
    --primary-dark: #4338CA;
    --primary-light: #818CF8;
    --accent: #DB2777;
    /* Pink (Darkened for Light Mode A11y) */
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    --gradient-glow: linear-gradient(135deg, rgba(79, 70, 229, 0.4) 0%, rgba(219, 39, 119, 0.4) 100%);

    /* Backgrounds */
    --bg-body: #FAFAFA;
    --bg-surface: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-glass: rgba(255, 255, 255, 0.95);
    --bg-glass-border: rgba(0, 0, 0, 0.05);

    /* Text */
    --text-main: #0F172A;
    --text-muted: #475569;
    --text-light: #64748B;

    /* Dimensions */
    --header-h: 70px;
    --dock-h: 90px;
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --radius-pill: 9999px;

    /* Shadows & Glows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    --shadow-glow: 0 0 24px rgba(79, 70, 229, 0.15);
    --shadow-focus: 0 0 0 4px rgba(79, 70, 229, 0.2);

    /* Animation */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bounce: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Dark Mode Overrides */
html.dark {
    --bg-body: #0B0F19;
    --bg-surface: #111827;
    --bg-card: #141C2F;
    --bg-glass: rgba(11, 15, 25, 0.95);
    --bg-glass-border: rgba(255, 255, 255, 0.08);
    --accent: #EC4899;
    /* Restoring bright pink for Dark Mode */
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --text-light: #CBD5E1;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 24px rgba(236, 72, 153, 0.15);
    --shadow-focus: 0 0 0 4px rgba(129, 140, 248, 0.25);
}

/* --- 2. GLOBAL RESET & TYPOGRAPHY --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

/* Focus outlines for accessibility */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

html.dark *:focus-visible {
    outline-color: var(--primary-light);
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh;
    transition: background-color 0.3s, color 0.3s;
}

h1,
h2,
h3,
h4,
h5,
h6,
.logo-text,
.btn,
input {
    font-family: 'Outfit', sans-serif;
}

img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- 3. COMPONENTS --- */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s var(--ease-out);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px -8px rgba(236, 72, 153, 0.5);
}

/* Mobile Touch Target 48px minimums */
@media (max-width: 768px) {

    .btn,
    button,
    .theme-btn,
    .clear-btn,
    .fav-btn {
        min-height: 48px;
        min-width: 48px;
    }

    .back-to-top {
        bottom: 7rem;
    }
}

/* --- 4. HEADER --- */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--bg-glass-border);
    z-index: 100;
    display: flex;
    justify-content: center;
}

.header-inner {
    width: 100%;
    max-width: 1200px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    font-size: 1.5rem;
    color: var(--text-main);
}

.logo-emoji {
    font-size: 1.75rem;
}

.logo-text {
    font-weight: 800;
    letter-spacing: -0.03em;
}

.accent {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    display: inline-block;
}

/* Desktop Nav */
.header-nav {
    display: none;
}

@media (min-width: 768px) {
    .header-nav {
        display: flex;
        gap: 2rem;
        align-items: center;
    }

    .header-nav a {
        color: var(--text-muted);
        text-decoration: none;
        font-weight: 600;
        font-size: 0.95rem;
        transition: color 0.2s;
    }

    .header-nav a:hover,
    .header-nav a.active {
        color: var(--primary);
    }

    /* Dropdown CSS */
    .dropdown {
        position: relative;
        display: inline-block;
    }

    .dropdown-content {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        background-color: var(--bg-card);
        min-width: 220px;
        box-shadow: var(--shadow-lg);
        border: 1px solid var(--bg-glass-border);
        border-radius: var(--radius-sm);
        z-index: 1000;
        padding: 0.5rem 0;
        max-height: 400px;
        overflow-y: auto;
    }

    .dropdown:hover .dropdown-content,
    .dropdown:focus-within .dropdown-content {
        display: flex;
        flex-direction: column;
    }

    .dropdown-content a {
        color: var(--text-main);
        padding: 10px 16px;
        text-decoration: none;
        display: block;
        font-weight: 500;
        font-size: 0.9rem;
    }

    .dropdown-content a:hover {
        background-color: var(--bg-surface);
        color: var(--primary);
    }
}

/* Mobile Menu Button - 48px Target */
.mobile-menu-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    width: 48px;
    height: 48px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 120;
    padding: 0;
}

.mobile-menu-btn span {
    width: 24px;
    height: 2px;
    background-color: var(--text-main);
    border-radius: 4px;
    transition: all 0.3s var(--ease-out);
    margin: 0 auto;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Theme Toggle */
.theme-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-btn:hover {
    color: var(--primary);
    background: var(--bg-surface);
}

.theme-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

html.dark .sun {
    display: none;
}

html.dark .moon {
    display: block;
}

html:not(.dark) .sun {
    display: block;
}

html:not(.dark) .moon {
    display: none;
}

/* Mobile Nav Overlay */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--bg-body);
    z-index: 115;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.mobile-nav-overlay.active {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.mobile-nav-overlay a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
}

/* --- 5. MAIN CONTENT --- */
.app-main {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: calc(var(--header-h) + 2rem) 1.5rem calc(var(--dock-h) + 2rem);
}

.hero {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    padding: 2rem 0;
}



.hero h1 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
    letter-spacing: -0.03em;
}

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

/* Category Tabs */
.cat-nav {
    position: sticky;
    top: var(--header-h);
    z-index: 90;
    margin: 0 -1.5rem 2rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(to bottom, var(--bg-body) 80%, transparent);
}

.cat-scroll {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
}

.cat-scroll::-webkit-scrollbar {
    height: 6px;
}

.cat-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.cat-scroll::-webkit-scrollbar-thumb {
    background: var(--bg-glass-border);
    border-radius: var(--radius-pill);
}

.cat-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

@media (hover: none) and (pointer: coarse) {
    .cat-scroll::-webkit-scrollbar {
        display: none;
    }
}

.tab-btn {
    flex: 0 0 auto;
    background: var(--bg-surface);
    border: 1px solid var(--bg-glass-border);
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.tab-btn:hover {
    background: var(--bg-card);
    color: var(--text-main);
    border-color: var(--primary-light);
}

.tab-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(108, 92, 231, 0.3);
}

/* Results Grid */
.results-wrapper {
    min-height: 800px;
    /* CLS Guard for text generation area */
}

/* Ad Slot CLS Guard */
.ad-slot {
    min-height: 250px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem auto;
    background-color: var(--bg-surface);
    border-radius: var(--radius-sm);
}

.grid-layout {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.category-header {
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 800;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.category-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--bg-glass-border);
}

.cat-group {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .cat-group {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--bg-glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.card:active {
    transform: scale(0.98);
}

.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.card-content {
    font-size: 1.25rem;
    font-weight: 500;
    word-break: break-all;
    line-height: 1.4;
}

/* --- 6. FLOATING DOCK (Mobile First Input) --- */
.dock-wrapper {
    position: fixed;
    bottom: 2rem;
    left: 1rem;
    right: 1rem;
    z-index: 110;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 1rem;
    pointer-events: none;
}

.dock-inner {
    width: 100%;
    max-width: 800px;
    background: var(--bg-card);
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    border: 1px solid var(--bg-glass-border);
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
    display: flex;
    align-items: center;
}

.dock-inner:focus-within {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.input-box {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

input[type="text"] {
    width: 100%;
    height: 60px;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.2rem;
    padding: 0 4rem 0 1.5rem;
    outline: none;
    font-weight: 500;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 0;
}

input::placeholder {
    color: var(--text-muted);
}

.input-actions {
    position: absolute;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-surface);
    padding: 4px 8px;
    border-radius: 6px;
}

.clear-btn {
    background: var(--text-muted);
    color: #fff;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
}

.clear-btn.hidden {
    display: none;
}

/* Social Share Dock */
.social-share-dock {
    display: inline-flex;
    justify-content: center;
    gap: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--bg-glass-border);
    border-radius: var(--radius-pill);
    pointer-events: auto;
    box-shadow: var(--shadow-md);
}

.social-share-dock a {
    color: var(--text-muted);
    transition: all 0.2s;
    display: flex;
}

.social-share-dock a:hover {
    color: var(--primary);
    transform: translateY(-2px);
}

.social-share-dock svg {
    width: 24px;
    height: 24px;
}

.toast {
    position: fixed;
    bottom: calc(2rem + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--text-main);
    color: var(--bg-card);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 1rem;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s var(--ease-bounce);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Inline Copy Badge */
.copied-badge {
    position: fixed;
    background: var(--primary);
    color: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-pill);
    font-size: 0.9rem;
    font-weight: 600;
    pointer-events: none;
    z-index: 2000;
    opacity: 0;
    transform: translate(-50%, 15px);
    transition: all 0.3s var(--ease-bounce);
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.copied-badge.show {
    opacity: 1;
    transform: translate(-50%, -10px);
}

/* Content Article (SEO Text) */
.content-article {
    max-width: 800px;
    margin: 4rem auto 0;
    color: var(--text-muted);
}

.content-article h2,
.content-article h3 {
    color: var(--text-main);
    margin: 2rem 0 1rem;
}

.content-article p {
    margin-bottom: 1.5rem;
}

/* Footer */
.simple-footer {
    text-align: center;
    padding: 4rem 1rem 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--bg-glass-border);
    margin-top: 4rem;
}

.simple-footer nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.simple-footer a {
    color: inherit;
    text-decoration: none;
    font-weight: 500;
}

.simple-footer a:hover {
    color: var(--primary);
}

/* Utilities */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

/* Back to Top */
.back-to-top {
    position: fixed;
    bottom: 8rem;
    right: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--bg-glass-border);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.2s;
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    color: var(--text-muted);
}

.back-to-top.show {
    opacity: 1;
    pointer-events: auto;
}

.back-to-top:hover {
    color: var(--primary);
    transform: translateY(-2px);
}