@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

/* Light Theme Variables */
:root {
    --primary-color: #6200ee;
    --primary-variant: #3700b3;
    --secondary-color: #03dac6;
    --secondary-variant: #018786;
    --background: #fafafa;
    --surface: #ffffff;
    --error: #b00020;
    --on-primary: #ffffff;
    --on-secondary: #000000;
    --on-background: #000000;
    --on-surface: #000000;
    --on-error: #ffffff;

    /* Legacy colors for compatibility */
    --accent-color: #03dac6;
    --dark-bg: #fafafa;
    --dark-card: #ffffff;
    --dark-border: rgba(0, 0, 0, 0.12);
    --text-primary: #000000;
    --text-secondary: #424242;
    --text-muted: #757575;
    --success-color: #03dac6;
    --warning-color: #ff9800;
    --danger-color: #b00020;

    /* Material Design Gradients */
    --gradient-1: linear-gradient(135deg, #6200ee 0%, #3700b3 100%);
    --gradient-2: linear-gradient(135deg, #03dac6 0%, #018786 100%);
    --gradient-3: linear-gradient(135deg, #bb86fc 0%, #6200ee 100%);

    /* Material Design Elevation */
    --elevation-1: 0 2px 1px -1px rgba(0,0,0,.2), 0 1px 1px 0 rgba(0,0,0,.14), 0 1px 3px 0 rgba(0,0,0,.12);
    --elevation-2: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);
    --elevation-4: 0 2px 4px -1px rgba(0,0,0,.2), 0 4px 5px 0 rgba(0,0,0,.14), 0 1px 10px 0 rgba(0,0,0,.12);
    --elevation-6: 0 3px 5px -1px rgba(0,0,0,.2), 0 6px 10px 0 rgba(0,0,0,.14), 0 1px 18px 0 rgba(0,0,0,.12);

    /* Material Design Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-6: 24px;
    --space-8: 32px;
    --space-12: 48px;

    /* Legacy for compatibility */
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.12);
    --glass-shadow: var(--elevation-4);
    --glow-primary: 0 0 20px rgba(98, 0, 238, 0.3);
    --glow-secondary: 0 0 20px rgba(3, 218, 198, 0.3);
}

/* Dark Theme Variables */
[data-theme="dark"] {
    --primary-color: #bb86fc;
    --primary-variant: #3700b3;
    --secondary-color: #03dac6;
    --secondary-variant: #018786;
    --background: #121212;
    --surface: #1e1e1e;
    --error: #cf6679;
    --on-primary: #000000;
    --on-secondary: #000000;
    --on-background: #ffffff;
    --on-surface: #ffffff;
    --on-error: #000000;

    /* Legacy colors for compatibility */
    --accent-color: #03dac6;
    --dark-bg: #121212;
    --dark-card: #1e1e1e;
    --dark-border: rgba(255, 255, 255, 0.12);
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #757575;
    --success-color: #03dac6;
    --warning-color: #ffb74d;
    --danger-color: #cf6679;

    /* Material Design Gradients */
    --gradient-1: linear-gradient(135deg, #bb86fc 0%, #3700b3 100%);
    --gradient-2: linear-gradient(135deg, #03dac6 0%, #018786 100%);
    --gradient-3: linear-gradient(135deg, #bb86fc 0%, #6200ee 100%);

    /* Material Design Elevation */
    --elevation-1: 0 2px 1px -1px rgba(0,0,0,.2), 0 1px 1px 0 rgba(0,0,0,.14), 0 1px 3px 0 rgba(0,0,0,.12);
    --elevation-2: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);
    --elevation-4: 0 2px 4px -1px rgba(0,0,0,.2), 0 4px 5px 0 rgba(0,0,0,.14), 0 1px 10px 0 rgba(0,0,0,.12);
    --elevation-6: 0 3px 5px -1px rgba(0,0,0,.2), 0 6px 10px 0 rgba(0,0,0,.14), 0 1px 18px 0 rgba(0,0,0,.12);

    /* Legacy for compatibility */
    --glass-bg: rgba(30, 30, 30, 0.9);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-shadow: var(--elevation-4);
    --glow-primary: 0 0 20px rgba(187, 134, 252, 0.3);
    --glow-secondary: 0 0 20px rgba(3, 218, 198, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--on-background);
    line-height: 1.5;
    overflow-x: hidden;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Material Design Background */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: var(--background);
    transition: background 0.3s ease;
}

.bg-animation::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(98, 0, 238, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(3, 218, 198, 0.03) 0%, transparent 50%);
    transition: opacity 0.3s ease;
}

[data-theme="dark"] .bg-animation::before {
    background-image:
        radial-gradient(circle at 20% 80%, rgba(187, 134, 252, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(3, 218, 198, 0.03) 0%, transparent 50%);
}

/* Material Design Surface Components */
.md-surface {
    background: var(--surface);
    border-radius: 4px;
    box-shadow: var(--elevation-1);
    transition: box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.md-card {
    background: var(--surface);
    border-radius: 12px;
    padding: var(--space-6);
    box-shadow: var(--elevation-1);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid var(--dark-border);
}

.md-card:hover {
    box-shadow: var(--elevation-4);
    transform: translateY(-5px);
}

/* Legacy glass classes for compatibility */
.glass {
    background: var(--surface);
    border-radius: 4px;
    box-shadow: var(--elevation-1);
    transition: box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.glass-card {
    background: var(--surface);
    border-radius: 12px;
    padding: var(--space-6);
    box-shadow: var(--elevation-1);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid var(--dark-border);
}

.glass-card:hover {
    box-shadow: var(--elevation-4);
    transform: translateY(-5px);
}

/* Material Design App Bar */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--surface);
    border-bottom: 1px solid var(--dark-border);
    padding: var(--space-3) 0;
    box-shadow: var(--elevation-4);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
}

.logo {
    font-size: 20px;
    font-weight: 500;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    letter-spacing: 0.15px;
    margin: 0;
}

.nav-buttons {
    display: flex;
    gap: var(--space-3);
    align-items: center;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--dark-border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--on-surface);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.25px;
    min-height: 36px;
    position: relative;
    overflow: hidden;
    outline: none;
    font-family: 'Roboto', sans-serif;
}

.theme-toggle-btn:hover {
    background: rgba(98, 0, 238, 0.08);
    border-color: var(--primary-color);
}

.theme-toggle-btn:focus {
    box-shadow: 0 0 0 2px rgba(98, 0, 238, 0.3);
}

.theme-icon-light,
.theme-icon-dark {
    transition: all 0.3s ease;
    font-size: 16px;
}

.theme-icon-light {
    opacity: 1;
}

.theme-icon-dark {
    opacity: 0;
    position: absolute;
    left: var(--space-3);
}

[data-theme="dark"] .theme-icon-light {
    opacity: 0;
}

[data-theme="dark"] .theme-icon-dark {
    opacity: 1;
}

.theme-text {
    transition: color 0.3s ease;
}

/* Material Design Buttons */
.btn {
    padding: var(--space-3) var(--space-4);
    border: none;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1.25px;
    min-height: 36px;
    position: relative;
    overflow: hidden;
    outline: none;
    font-family: 'Roboto', sans-serif;
}

.btn:focus {
    box-shadow: 0 0 0 2px rgba(98, 0, 238, 0.3);
}

.btn-primary {
    background: var(--primary-color);
    color: var(--on-primary);
    box-shadow: var(--elevation-2);
}

.btn-primary:hover {
    background: var(--primary-variant);
    box-shadow: var(--elevation-4);
}

.btn-primary:active {
    box-shadow: var(--elevation-6);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-secondary:hover {
    background: rgba(98, 0, 238, 0.08);
}

/* Material Design Main Content */
.main-content {
    padding: var(--space-12) 0;
}

.hero-section {
    text-align: center;
    margin-bottom: var(--space-12);
}

.hero-title {
    font-size: clamp(34px, 8vw, 56px);
    font-weight: 300;
    margin-bottom: var(--space-4);
    color: var(--on-background);
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.hero-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: var(--space-8);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0.5px;
}

/* Material Design Search Section */
.search-section {
    margin-bottom: var(--space-12);
}

.search-container {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 var(--space-2);
}

/* Material Design Text Field */
.search-input {
    width: 100%;
    padding: var(--space-4) calc(var(--space-6) + 48px) var(--space-4) var(--space-4);
    font-size: 16px;
    background: var(--surface);
    border: 1px solid var(--dark-border);
    border-radius: 4px;
    color: var(--on-surface);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 400;
    font-family: 'Roboto', sans-serif;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    border-width: 2px;
    box-shadow: 0 0 0 1px var(--primary-color);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    background: var(--primary-color);
    border: none;
    border-radius: 0 4px 4px 0;
    padding: 0 var(--space-4);
    color: var(--on-primary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.25px;
    box-shadow: none;
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    background: var(--primary-variant);
}

.search-btn:active {
    background: var(--primary-variant);
}

/* Material Design Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-12);
}

.stat-card {
    text-align: center;
    padding: var(--space-6) var(--space-4);
    background: var(--surface);
    border-radius: 8px;
    box-shadow: var(--elevation-1);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid var(--dark-border);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: var(--elevation-4);
    transform: translateY(-5px);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-color);
    transform: scaleX(0);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform-origin: left;
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-value {
    font-size: 34px;
    font-weight: 300;
    margin-bottom: var(--space-2);
    color: var(--primary-color);
    letter-spacing: 0.25px;
}

.keyword-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
    gap: var(--space-4);
    align-items: center;
    padding: var(--space-4);
    background: var(--surface);
    border-radius: 8px;
    box-shadow: var(--elevation-1);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid var(--dark-border);
    position: relative;
}

.keyword-item:hover {
    box-shadow: var(--elevation-4);
    transform: translateY(-5px);
}

.keyword-main {
    display: flex;
    position: relative;
    overflow: hidden;
}

.keyword-main {
    position: relative;
    overflow: hidden;
}
.stat-label {
    color: var(--text-secondary);
    font-size: 12px;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: var(--elevation-1);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid var(--dark-border);
    position: relative;
}

.keyword-item:hover {
    box-shadow: var(--elevation-4);
    transform: translateY(-5px);
}

.keyword-main {
    display: flex;
    position: relative;
    overflow: hidden;
}
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

/* Enhanced Results section */
.results-section {
    display: none;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-8);
    flex-wrap: wrap;
    gap: var(--space-4);
}

.results-title {
    font-size: 24px;
    font-weight: 400;
    color: var(--on-background);
    letter-spacing: 0.15px;
}

.filter-tabs {
    display: flex;
    gap: var(--space-1);
    background: var(--surface);
    padding: var(--space-1);
    border-radius: 8px;
    border: 1px solid var(--dark-border);
}

.filter-tab {
    padding: var(--space-3) var(--space-4);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.25px;
    min-height: 36px;
}

.filter-tab.active {
    background: var(--primary-color);
    color: var(--on-primary);
    box-shadow: var(--elevation-2);
}

.filter-tab:hover:not(.active) {
    background: rgba(98, 0, 238, 0.08);
    color: var(--primary-color);
}

/* Material Design Keyword List */
.keyword-list {
    display: grid;
    gap: var(--space-3);
}

.keyword-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
    gap: var(--space-4);
    align-items: center;
    padding: var(--space-4);
    background: var(--surface);
    border-radius: 8px;
    box-shadow: var(--elevation-1);
    transition: box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid var(--dark-border);
    position: relative;
}

.keyword-item:hover {
    box-shadow: var(--elevation-4);
}

.keyword-main {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.keyword-text {
    font-size: 16px;
    font-weight: 400;
    color: var(--on-surface);
    letter-spacing: 0.15px;
}

.keyword-intent {
    font-size: 12px;
    padding: var(--space-1) var(--space-3);
    border-radius: 12px;
    display: inline-block;
    width: fit-content;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    height: 24px;
    line-height: 24px;
}

.intent-informational { background: rgba(98, 0, 238, 0.12); color: var(--primary-color); }
.intent-commercial { background: rgba(255, 179, 77, 0.12); color: var(--warning-color); }
.intent-transactional { background: rgba(3, 218, 198, 0.12); color: var(--secondary-color); }
.intent-navigational { background: rgba(187, 134, 252, 0.12); color: #bb86fc; }

.metric {
    text-align: center;
}

.metric-value {
    font-size: 20px;
    font-weight: 400;
    margin-bottom: var(--space-1);
    color: var(--on-surface);
}

.metric-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.difficulty-bar {
    width: 80px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px auto;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.difficulty-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px currentColor;
}

.difficulty-low { background: var(--success-color); }
.difficulty-medium { background: var(--warning-color); }
.difficulty-high { background: var(--danger-color); }

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: var(--space-3);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 20px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.action-btn:hover {
    background: rgba(98, 0, 238, 0.08);
    color: var(--primary-color);
}

.action-btn:active {
    background: rgba(98, 0, 238, 0.12);
}

/* Material Design Loading */
.loading {
    display: none;
    text-align: center;
    padding: var(--space-8);
}

.loading-spinner {
    display: inline-block;
    width: 48px;
    height: 48px;
    border: 4px solid rgba(98, 0, 238, 0.12);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Material Design Responsive Design */
@media (max-width: 768px) {
    .keyword-item {
        grid-template-columns: 1fr;
        gap: var(--space-4);
        text-align: center;
    }

    .metric {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: var(--space-3);
        background: rgba(255, 255, 255, 0.05);
        border-radius: 8px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .results-header {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-tabs {
        flex-wrap: wrap;
        justify-content: center;
    }

    .container {
        padding: 0 var(--space-4);
    }

    .main-content {
        padding: var(--space-8) 0;
    }

    .hero-section {
        margin-bottom: var(--space-8);
    }

    .search-section {
        margin-bottom: var(--space-8);
    }

    .stats-grid {
        margin-bottom: var(--space-8);
    }
}

/* Material Design Chart Container */
.chart-container {
    height: 400px;
    margin: var(--space-6) 0;
    position: relative;
    background: var(--surface);
    border-radius: 8px;
    padding: var(--space-4);
    border: 1px solid var(--dark-border);
    box-shadow: var(--elevation-1);
    overflow: hidden;
}

.chart-canvas {
    width: 100%;
    height: 100%;
}

/* Material Design Messages */
.error-message {
    background: rgba(207, 102, 121, 0.12);
    border: 1px solid rgba(207, 102, 121, 0.5);
    color: var(--error);
    padding: var(--space-3);
    border-radius: 4px;
    margin: var(--space-3) 0;
    display: none;
    font-size: 14px;
    font-weight: 400;
}

.success-message {
    background: rgba(3, 218, 198, 0.12);
    border: 1px solid rgba(3, 218, 198, 0.5);
    color: var(--secondary-color);
    padding: var(--space-3);
    border-radius: 4px;
    margin: var(--space-3) 0;
    display: none;
    font-size: 14px;
    font-weight: 400;
}