/* Labb SEO - Modern Dark Theme */
:root {
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-tertiary: #18181b;
    --bg-card: #1c1c1f;
    --bg-hover: #27272a;
    --border-color: #27272a;
    --border-subtle: #1f1f22;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent-cyan: #06b6d4;
    --accent-cyan-dim: rgba(6, 182, 212, 0.15);
    --accent-green: #22c55e;
    --accent-green-dim: rgba(34, 197, 94, 0.15);
    --accent-red: #ef4444;
    --accent-red-dim: rgba(239, 68, 68, 0.15);
    --accent-yellow: #eab308;
    --accent-yellow-dim: rgba(234, 179, 8, 0.15);
    --accent-blue: #3b82f6;
    --accent-blue-dim: rgba(59, 130, 246, 0.15);
    --accent-purple: #a855f7;
    --sidebar-width: 240px;
    --topbar-height: 60px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --font-mono: 'JetBrains Mono', monospace;
    --font-sans: 'Inter', -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* App Layout */
.app-container { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.2s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.1rem; }
.logo-icon { color: var(--accent-cyan); font-size: 1.4rem; }
.sidebar-close { display: none; background: none; border: none; color: var(--text-secondary); padding: 8px; }
.nav-section { padding: 12px; flex: 1; }
.nav-section-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); padding: 8px 12px; margin-top: 12px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all 0.15s ease;
    margin-bottom: 2px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-cyan-dim); color: var(--accent-cyan); }
.nav-item svg { width: 18px; height: 18px; }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border-color); }
.logout-btn:hover { background: var(--accent-red-dim); color: var(--accent-red); }

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-bar {
    height: var(--topbar-height);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 50;
}

.menu-toggle { display: none; background: none; border: none; color: var(--text-secondary); padding: 8px; margin-right: 12px; }
.page-title { font-size: 1.1rem; font-weight: 600; }
.top-bar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.user-name { font-size: 0.85rem; color: var(--text-secondary); }
.content-area { padding: 24px; flex: 1; }

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 0.9rem;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; }
.alert-success { background: var(--accent-green-dim); color: var(--accent-green); }
.alert-error { background: var(--accent-red-dim); color: var(--accent-red); }
.alert-warning { background: var(--accent-yellow-dim); color: var(--accent-yellow); }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; position: relative; }
.card-title { font-size: 0.9rem; font-weight: 600; }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.stat-value { font-size: 2rem; font-weight: 700; font-family: var(--font-mono); }
.stat-value.up { color: var(--accent-green); }
.stat-value.down { color: var(--accent-red); }
.stat-value.paused { color: var(--accent-yellow); }
.stat-value.cyan { color: var(--accent-cyan); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent-cyan); color: #000; }
.btn-primary:hover { background: #0891b2; }
.btn-secondary { background: var(--bg-hover); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-secondary:hover { border-color: var(--text-muted); }
.btn-danger { background: var(--accent-red-dim); color: var(--accent-red); }
.btn-danger:hover { background: var(--accent-red); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 6px; color: var(--text-secondary); }
.form-input, .form-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
}
.form-input:focus, .form-select:focus { outline: none; border-color: var(--accent-cyan); }
.form-input::placeholder { color: var(--text-muted); }

/* Tables */
.table-container { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border-color); }
.table th { font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); font-weight: 500; }
.table tbody tr:hover { background: var(--bg-hover); }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}
.badge-success { background: var(--accent-green-dim); color: var(--accent-green); }
.badge-danger { background: var(--accent-red-dim); color: var(--accent-red); }
.badge-warning { background: var(--accent-yellow-dim); color: var(--accent-yellow); }
.badge-info { background: var(--accent-blue-dim); color: var(--accent-blue); }
.badge-secondary { background: var(--bg-hover); color: var(--text-secondary); }
.badge-cyan { background: var(--accent-cyan-dim); color: var(--accent-cyan); }

/* Page Subtitles */
.page-subtitle { color: var(--text-muted); margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 0.85rem; }

/* Empty States */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state-title { font-size: 1.1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }

/* Grid Layout Helpers */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
@media (max-width: 768px) { .grid-2 { grid-template-columns: 1fr; } }

/* Loading States */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}
@keyframes skeleton-loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }
    .sidebar-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 99; display: none; }
    .sidebar-overlay.active { display: block; }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .top-bar { padding: 0 16px; }
    .content-area { padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat-value { font-size: 1.5rem; }
}

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-primary);
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo .logo-icon { font-size: 2.5rem; }
.auth-logo .logo-text { font-size: 1.5rem; font-weight: 700; margin-top: 8px; display: block; }
.auth-title { font-size: 1.25rem; font-weight: 600; margin-bottom: 8px; text-align: center; }
.auth-subtitle { color: var(--text-muted); font-size: 0.9rem; text-align: center; margin-bottom: 32px; }
.auth-form .form-group { margin-bottom: 16px; }
.auth-form .btn { width: 100%; justify-content: center; margin-top: 8px; }
.auth-footer { text-align: center; margin-top: 24px; font-size: 0.85rem; color: var(--text-muted); }
.email-sent-message { text-align: center; padding: 24px; }
.email-sent-message svg { width: 64px; height: 64px; color: var(--accent-cyan); margin-bottom: 16px; }

/* Score Badges */
.score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-mono);
}
.score-badge.score-lg {
    min-width: 56px;
    padding: 8px 14px;
    font-size: 1.1rem;
    border-radius: var(--radius-md);
}
.score-green { background: var(--accent-green-dim); color: var(--accent-green); }
.score-yellow { background: var(--accent-yellow-dim); color: var(--accent-yellow); }
.score-red { background: var(--accent-red-dim); color: var(--accent-red); }
.score-secondary { background: var(--bg-hover); color: var(--text-muted); }

/* Crawl Progress Bar */
.crawl-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}
.crawl-progress-fill {
    height: 100%;
    background: var(--accent-cyan);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Issue Items */
.issue-item {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border-left: 3px solid transparent;
}
.issue-critical { background: var(--accent-red-dim); border-left-color: var(--accent-red); }
.issue-warning { background: var(--accent-yellow-dim); border-left-color: var(--accent-yellow); }
.issue-info { background: var(--accent-blue-dim); border-left-color: var(--accent-blue); }

/* AI Analysis */
.ai-score-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 768px) { .ai-score-grid { grid-template-columns: repeat(2, 1fr); } }

.ai-analysis-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    line-height: 1.5;
    border-left: 3px solid transparent;
}
.ai-strength { background: var(--accent-green-dim); border-left-color: var(--accent-green); }
.ai-improvement { background: var(--accent-yellow-dim); border-left-color: var(--accent-yellow); }

.ai-keyword {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--accent-blue-dim);
    color: var(--accent-blue);
}

.spin { animation: spin 1s linear infinite; }

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute;
    inset: 0;
    background: var(--bg-tertiary);
    border: 1px solid #52525b;
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.switch .slider::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 16px;
    height: 16px;
    background: #71717a;
    border-radius: 50%;
    transition: transform 0.2s ease, background 0.2s ease;
}
.switch input:checked + .slider { background: var(--accent-cyan-dim); border-color: var(--accent-cyan); }
.switch input:checked + .slider::before { transform: translateX(20px); background: var(--accent-cyan); }

/* Chart Grid */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}
.chart-card {
    height: 340px;
}
.chart-card canvas {
    max-height: 260px;
}
.chart-card-wide {
    height: 400px;
}
.chart-card-wide canvas {
    max-height: 320px;
}
@media (max-width: 768px) {
    .chart-grid { grid-template-columns: 1fr; }
    .chart-card { height: 300px; }
    .chart-card-wide { height: 350px; }
}
