/* ==========================================================================
   WordLab - Design System (Linear/Attio Style)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@200;300;400;500;600&display=swap');

:root {
    /* Base Colors - Whitespace Theme */
    --bg-page: #FFFFFF;
    --bg-surface: rgba(255, 255, 255, 0.6);
    --bg-surface-hover: rgba(248, 249, 251, 0.8);
    
    /* Text Colors */
    --text-main: #111827;
    --text-muted: #6B7280;
    --text-light: #9CA3AF;

    /* Linear/Attio Style Borders */
    --border-light: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
    
    /* Neon Accents (AI Theme) */
    --accent-primary: #6366f1; /* Indigo */
    --accent-cyan: #06b6d4;    /* Cyan */
    --accent-pink: #ec4899;    /* Pink */
    --accent-glow: 0 0 20px rgba(99, 102, 241, 0.3);
    
    /* Gradients */
    --gradient-text: linear-gradient(135deg, #111827 0%, #4B5563 100%);
    --gradient-border: linear-gradient(90deg, var(--accent-cyan), var(--accent-primary), var(--accent-pink));
    
    /* Spacing & Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 9999px;
    
    /* Glassmorphism */
    --glass-blur: blur(12px);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.06);
}

/* Reset & Base */
body {
    background-color: var(--bg-page);
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    line-height: 1.6;
    font-weight: 300;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    /* Subtle background grid pattern */
    background-image: 
        linear-gradient(var(--border-light) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-light) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: center top;
}

/* Subtle ambient light spots */
body::before {
    content: '';
    position: fixed;
    top: -10%;
    left: 20%;
    width: 60vw;
    height: 60vh;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 60%);
    z-index: -1;
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    bottom: -10%;
    right: 10%;
    width: 50vw;
    height: 50vh;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.08) 0%, transparent 60%);
    z-index: -1;
    pointer-events: none;
}

a { text-decoration: none; color: inherit; transition: 0.2s; }
ul { list-style: none; padding: 0; margin: 0; }

/* ================= Components ================= */

/* 1. Navigation (Minimalist) */
.navbar-custom {
    backdrop-filter: var(--glass-blur);
    background: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid var(--border-light);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1050;
}

.logo {
    font-weight: 600;
    font-size: 1.5rem;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-image {
    height: 32px;
    width: auto;
    transition: transform 0.3s ease;
}

.logo:hover .logo-image {
    transform: scale(1.05);
}

.logo span {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-link-custom {
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-link-custom i {
    font-size: 0.95rem;
}

.nav-link-custom:hover {
    color: var(--text-main);
    background: var(--bg-surface-hover);
}

/* Dropdown Menu */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    cursor: pointer;
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1051;
    padding: 0.5rem 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    max-width: 500px;
    width: max-content;
}

.nav-dropdown-menu.align-right {
    left: auto;
    right: 0;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.active .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.75rem 1.25rem;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    white-space: nowrap;
}

.nav-dropdown-item:hover {
    background: var(--bg-surface-hover);
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
    padding-left: 1.5rem;
}

.nav-dropdown-item i {
    font-size: 1rem;
    width: 18px;
    text-align: center;
}

/* Burger Menu Button */
.burger-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    position: relative;
}

.burger-menu-btn span {
    width: 100%;
    height: 3px;
    background: var(--text-main);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

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

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

.burger-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Menu */
.nav-menu-mobile {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 1100;
    transition: right 0.3s ease;
    overflow-y: auto;
    display: none;
}

.nav-menu-mobile.active {
    right: 0;
    display: block;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1090;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

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

.mobile-menu-content {
    padding: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.mobile-menu-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    color: var(--text-main);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    font-size: 1rem;
    font-weight: 500;
}

.mobile-nav-link:hover {
    background: var(--bg-surface-hover);
    color: var(--accent-primary);
    transform: translateX(4px);
}

.mobile-nav-link i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.mobile-menu-section {
    margin-bottom: 1.5rem;
}

.mobile-menu-section:last-child {
    margin-bottom: 0;
}

.mobile-menu-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

.mobile-menu-section-title i {
    font-size: 0.9rem;
}

/* Mobile search form inside burger menu */
.mobile-search-form {
    padding: 0.5rem 1rem 0.25rem;
}

.mobile-search-input {
    border-radius: var(--radius-pill);
    box-shadow: none;
    font-size: 0.95rem;
    padding: 0.55rem 1.1rem;
}

/* Responsive: Hide desktop menu on mobile/tablet */
@media (max-width: 767.98px) {
    .nav-menu-desktop {
        display: none !important;
    }
    
    .burger-menu-btn {
        display: flex;
    }
    
    .nav-menu-mobile.active {
        display: block;
    }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 991.98px) {
    .nav-menu-desktop {
        display: none !important;
    }
    
    .burger-menu-btn {
        display: flex;
    }
    
    .nav-menu-mobile {
        max-width: 400px;
    }
    
    .nav-menu-mobile.active {
        display: block;
    }
}

/* Desktop: Hide mobile menu */
@media (min-width: 992px) {
    .nav-menu-mobile {
        display: none !important;
    }
    
    .burger-menu-btn {
        display: none !important;
    }
    
    .mobile-menu-overlay {
        display: none !important;
    }
}

/* 2. Hero Section (Center Search) */
.hero-section {
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    position: relative;
}

.hero-title {
    font-size: clamp(3rem, 5vw, 5rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    margin-bottom: 1rem;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
    margin-bottom: 3rem;
}

/* 3. Search Component (The Core) */
.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    transition: transform 0.3s ease;
    z-index: 100;
}

.search-wrapper:focus-within {
    transform: translateY(-2px);
}

.search-box {
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    padding-right: 120px; /* Space for button */
    font-size: 1.2rem;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    box-shadow: var(--shadow-md);
    outline: none;
    transition: all 0.3s ease;
}

.search-box:focus {
    border-color: transparent;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1), var(--shadow-md);
    background: #fff;
}

/* Gradient border effect on focus */
.search-wrapper::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: calc(var(--radius-lg) + 1px);
    padding: 1px;
    background: var(--gradient-border);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.search-wrapper:focus-within::after {
    opacity: 1;
}

.search-btn-ai {
    position: absolute;
    right: 8px;
    top: 8px;
    bottom: 8px;
    background: #111827;
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0 1.5rem;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-btn-ai:hover {
    background: #000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.sparkle-icon {
    animation: spin 4s linear infinite;
}

@keyframes spin { 100% { transform: rotate(360deg); } }

/* Autocomplete */
.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s;
    color: var(--text-main);
}

.autocomplete-item:hover,
.autocomplete-item:focus {
    background: var(--bg-surface-hover);
    outline: none;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-top: 8px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    z-index: 9999;
    display: none;
}

.autocomplete-dropdown.active {
    display: block;
}

.autocomplete-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-main);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: rgba(99, 102, 241, 0.05);
    color: var(--accent-primary);
    padding-left: 24px;
}
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-top: 40px;
}

@media (max-width: 992px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 2rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.glass-panel:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
}

.word-header-huge {
    font-size: 4rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 1rem;
    background: linear-gradient(180deg, #111827 0%, #374151 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.phonetic {
    font-family: 'Inter', monospace;
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-bottom: 2rem;
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-pill);
}

.definition-row {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
    border-left: 2px solid var(--accent-primary);
}

.definition-row .pos {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.definition-row .text {
    font-size: 1.1rem;
    color: var(--text-main);
}

/* 5. AI Analytics Cards */
.analytics-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stat-card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-cyan), transparent);
    opacity: 0.5;
}

.stat-value {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-main);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* 6. Footer */
.footer-minimal {
    margin-top: auto;
    padding: 2rem 0;
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-light);
}

/* Helper Classes */
.badge-ai {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-primary);
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 1rem;
    border: 1px solid rgba(99, 102, 241, 0.1);
}

.badge-dot {
    width: 6px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    70% { opacity: 0.5; box-shadow: 0 0 0 6px rgba(99, 102, 241, 0); }
    100% { opacity: 1; box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

/* Synonyms Tag Cloud */
.synonym-chip {
    display: inline-block;
    padding: 6px 14px;
    margin: 4px;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-main);
    transition: all 0.2s;
}

.synonym-chip:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Visualizations */
.chart-placeholder {
    height: 150px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding-top: 20px;
    position: relative;
}

.chart-bar {
    flex: 1;
    background: linear-gradient(180deg, var(--accent-primary) 0%, var(--accent-cyan) 100%);
    opacity: 0.9;
    border-radius: 4px 4px 0 0;
    transition: height 0.5s ease, opacity 0.3s ease;
    min-height: 2px;
    width: 100%;
}

.chart-bar:hover {
    opacity: 1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.chart-container {
    position: relative;
    width: 100%;
}

.trends-chart-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    gap: 20px;
    padding: 20px 0;
    min-height: 350px;
}

.chart-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 50px;
    padding-top: 10px;
    padding-bottom: 30px;
}

.y-axis-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-align: right;
    padding-right: 12px;
}

.chart-main-area {
    flex: 1;
    position: relative;
    min-height: 300px;
}

.trends-chart-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.chart-x-axis {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    padding: 0 30px;
    gap: 8px;
}

.x-axis-item {
    flex: 1;
    text-align: center;
    min-width: 0;
    padding: 4px 0;
}

.x-axis-date {
    font-size: 0.875rem;
    color: #4b5563;
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
}

.x-axis-value {
    font-size: 1rem;
    color: #111827;
    font-weight: 700;
    display: block;
}

.chart-point-group {
    cursor: pointer;
}

.chart-dot {
    transition: r 0.2s ease, opacity 0.2s ease;
}

.chart-hit-area {
    cursor: pointer;
}

.chart-point-group:hover .chart-dot {
    r: 7;
    opacity: 0.9;
}

.chart-tooltip {
    position: absolute;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1000;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    transform: translate(-50%, -100%) translateY(-10px);
    border: 1px solid rgba(255,255,255,0.1);
}

.chart-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(17, 24, 39, 0.95);
}

.chart-tooltip strong {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

@media (max-width: 768px) {
    .trends-chart-wrapper {
        flex-direction: column;
        gap: 10px;
    }
    
    .chart-y-axis {
        flex-direction: row;
        min-width: auto;
        padding: 0;
        margin-bottom: 10px;
    }
    
    .y-axis-label {
        text-align: center;
        padding: 0;
        flex: 1;
    }
    
    .chart-x-axis {
        padding: 0 10px;
    }
    
    .x-axis-item {
        font-size: 0.7rem;
    }
}

/* Word Graph Styles */
.word-graph-container {
    min-height: 400px;
    position: relative;
    background: linear-gradient(135deg, rgba(248, 249, 251, 0.5) 0%, rgba(255, 255, 255, 0.8) 100%);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.word-graph-container canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: default;
}

.graph-tooltip {
    position: absolute;
    background: rgba(17, 24, 39, 0.95);
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    pointer-events: none;
    display: none;
    z-index: 10;
    box-shadow: var(--shadow-md);
    transform: translateX(-50%);
    white-space: nowrap;
}

.graph-tooltip::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid rgba(17, 24, 39, 0.95);
}

.graph-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-main);
    transition: all 0.2s;
    cursor: default;
}

.graph-legend-item:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-hover);
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}
