/* =========================================
   Browser Feature Detector — Styles
   Primary: #3B82F6, Accent: #10B981
   Background: #0F172A
   ========================================= */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3B82F6;
    --primary-light: #60A5FA;
    --primary-dark: #2563EB;
    --primary-glow: rgba(59, 130, 246, 0.15);
    --accent: #10B981;
    --accent-light: #34D399;
    --accent-glow: rgba(16, 185, 129, 0.15);

    --bg-base: #0F172A;
    --bg-surface: #1E293B;
    --bg-elevated: #273548;
    --bg-hover: #334155;
    --bg-input: #0D1321;

    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --text-inverse: #0F172A;

    --border: #334155;
    --border-focus: #3B82F6;

    --success: #10B981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --error: #EF4444;
    --error-bg: rgba(239, 68, 68, 0.12);
    --warning: #F59E0B;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);
}

/* Light theme */
[data-theme="light"] {
    --bg-base: #F8FAFC;
    --bg-surface: #FFFFFF;
    --bg-elevated: #F1F5F9;
    --bg-hover: #E2E8F0;
    --bg-input: #FFFFFF;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --text-inverse: #FFFFFF;
    --border: #CBD5E1;
    --success-bg: rgba(16, 185, 129, 0.1);
    --error-bg: rgba(239, 68, 68, 0.08);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

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

.app-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px 60px;
}

/* Header */
.app-header {
    padding: 20px 0 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    color: #fff;
    box-shadow: 0 0 20px var(--primary-glow);
    flex-shrink: 0;
}

h1 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Search */
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    transition: border-color var(--transition-fast);
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-box svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-box input {
    border: none;
    background: transparent;
    font-family: var(--font);
    font-size: 0.85rem;
    color: var(--text-primary);
    outline: none;
    width: 160px;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

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

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

.btn-filter {
    padding: 6px 10px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-filter.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-filter:hover:not(.active) {
    background: var(--bg-hover);
}

.btn-group {
    display: flex;
    gap: 2px;
}

/* Summary Bar */
.summary-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.summary-stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.summary-stat.supported .stat-number {
    color: var(--success);
}

.summary-stat.unsupported .stat-number {
    color: var(--error);
}

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

.browser-info {
    margin-left: auto;
    font-size: 0.82rem;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
}

/* Category Tabs */
.category-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.tab {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.tab:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.tab.active {
    background: var(--primary-glow);
    color: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.feature-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
    animation: fadeInUp 300ms ease backwards;
}

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

.feature-card.supported {
    border-left: 3px solid var(--success);
}

.feature-card.unsupported {
    border-left: 3px solid var(--error);
    opacity: 0.75;
}

.feature-card.unsupported:hover {
    opacity: 1;
}

.feature-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.feature-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.feature-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.feature-badge.yes {
    background: var(--success-bg);
    color: var(--success);
}

.feature-badge.no {
    background: var(--error-bg);
    color: var(--error);
}

.feature-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 10px;
}

.feature-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.feature-tag {
    font-size: 0.7rem;
    padding: 2px 8px;
    background: var(--bg-elevated);
    border-radius: 100px;
    color: var(--text-muted);
}

.feature-link {
    font-size: 0.72rem;
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.feature-link:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

.polyfill-hint {
    font-size: 0.72rem;
    color: var(--warning);
    margin-top: 6px;
    font-style: italic;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 20px;
    font-size: 0.85rem;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    opacity: 0;
    transition: transform var(--transition-base), opacity var(--transition-base);
    pointer-events: none;
}

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

.hidden {
    display: none !important;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 640px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
    }

    .search-box {
        flex: 1;
    }

    .search-box input {
        width: 100%;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .summary-bar {
        gap: 12px;
    }
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}