:root {
    --bg-base: #0b0f19;
    --sidebar-bg: rgba(15, 23, 42, 0.4);
    --panel-bg: rgba(255, 255, 255, 0.02);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --border-light: rgba(255, 255, 255, 0.05);
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --glass-blur: 24px;
}

body.light-theme {
    --bg-base: #f1f5f9;
    --sidebar-bg: rgba(255, 255, 255, 0.9);
    --panel-bg: rgba(255, 255, 255, 0.85);
    --text-main: #0f172a;
    --text-muted: #475569;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --border-light: rgba(0, 0, 0, 0.1);
}

body.light-theme .bg-glow {
    background: radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 30%),
                radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15), transparent 30%);
}

body.light-theme .sidebar-header h2 {
    background: linear-gradient(135deg, #1e293b, #475569);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

body.light-theme .nav-item:hover { background: rgba(0,0,0,0.05); color: var(--text-main); }
body.light-theme .stat-value { color: var(--text-main); }

/* Light Theme Overrides for hardcoded components */
body.light-theme .top-header { background: rgba(241, 245, 249, 0.9); border-bottom: 1px solid var(--border-light); }
body.light-theme .review-card { background: rgba(255, 255, 255, 0.6); border-color: rgba(0, 0, 0, 0.08); }
body.light-theme .review-card:hover { background: #ffffff; border-color: rgba(0, 0, 0, 0.15); box-shadow: 0 10px 25px rgba(0,0,0,0.05); }
body.light-theme .review-text { color: var(--text-main); font-weight: 400; }
body.light-theme .author-avatar { border-color: rgba(0, 0, 0, 0.1); }
body.light-theme .likes-count { background: rgba(0, 0, 0, 0.05); color: var(--text-main); }
body.light-theme .chart-tabs { background: rgba(0, 0, 0, 0.05); }
body.light-theme .tab-btn:hover { color: var(--text-main); }
body.light-theme .filter-btn { background: rgba(0, 0, 0, 0.03); border-color: rgba(0, 0, 0, 0.1); color: var(--text-muted); }
body.light-theme .filter-btn:hover { background: rgba(0, 0, 0, 0.08); color: var(--text-main); }
body.light-theme .loading-spinner .spinner { border: 3px solid rgba(0, 0, 0, 0.1); border-top-color: var(--accent); }
body.light-theme .form-group input { background: rgba(255, 255, 255, 0.7); border-color: rgba(0,0,0,0.15); color: var(--text-main); }
body.light-theme .form-group input:focus { background: #fff; }
body.light-theme .action-btn.dm-btn { background: rgba(0, 0, 0, 0.03); border-color: rgba(0, 0, 0, 0.1); color: var(--text-main); }
body.light-theme .action-btn.dm-btn:hover { background: rgba(0, 0, 0, 0.08); }
body.light-theme .action-btn.report-btn { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.2); color: #ef4444; }
body.light-theme .action-btn.report-btn:hover { background: #ef4444; color: white; }
body.light-theme .table-responsive { background: rgba(255,255,255,0.5); }
body.light-theme .tracker-table th { background: rgba(0,0,0,0.03); }
body.light-theme .tracker-table td { border-bottom: 1px solid rgba(0,0,0,0.05); }
body.light-theme .tracker-table tr:hover { background: rgba(0,0,0,0.02); }

/* Theme Toggle Button */
.theme-toggle {
    background: var(--panel-bg);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}
.theme-toggle:hover {
    background: rgba(128, 128, 128, 0.1);
    transform: scale(1.05);
}
.theme-toggle svg { width: 20px; height: 20px; }

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Outfit', sans-serif; }

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Animated Glow */
.bg-glow {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.08), transparent 25%),
                radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.08), transparent 25%);
    z-index: -1;
    pointer-events: none;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

/* Glassmorphism utility */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-light);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.app-container { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 260px;
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    border-top: none; border-bottom: none; border-left: none;
    background: var(--sidebar-bg);
}

.sidebar-header { padding: 2rem 1.5rem; border-bottom: 1px solid var(--border-light); }
.sidebar-header h2 {
    font-size: 1.5rem; font-weight: 700;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.sidebar-nav { padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.nav-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.875rem 1rem; border-radius: 12px;
    color: var(--text-muted); font-weight: 500; font-size: 0.95rem;
    transition: all 0.2s ease;
}
.nav-item svg { width: 20px; height: 20px; }
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text-main); }
.nav-item.active {
    background: linear-gradient(135deg, var(--accent), #6366f1);
    color: white; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Main Content */
.main-content { flex: 1; display: flex; flex-direction: column; }

.top-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.5rem 2rem; position: sticky; top: 0; z-index: 10;
    border-radius: 0; border-top: none; border-left: none; border-right: none;
    background: rgba(11, 15, 25, 0.8);
}
.top-header h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.5px; }
.subtitle { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.25rem; }
.section-subtitle { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.25rem; }

.user-profile .avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 1rem; box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.content-wrapper { padding: 2rem; flex: 1; max-width: 1400px; width: 100%; margin: 0 auto; }

/* Alerts */
.alert { padding: 1rem 1.5rem; border-radius: 12px; margin-bottom: 1.5rem; font-size: 0.95rem; }
.alert-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.alert-error { background: rgba(239, 68, 68, 0.1); color: var(--error); border: 1px solid rgba(239, 68, 68, 0.2); }

/* Overview Cards */
.overview-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem; margin-bottom: 2rem;
}
.stat-card {
    padding: 1.5rem; display: flex; align-items: center; gap: 1.5rem;
    position: relative; overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
}
.stat-icon {
    font-size: 2rem; width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 14px;
}
.icon-yellow { background: rgba(250, 204, 21, 0.1); text-shadow: 0 2px 10px rgba(250, 204, 21, 0.5); }
.icon-blue { background: rgba(59, 130, 246, 0.1); text-shadow: 0 2px 10px rgba(59, 130, 246, 0.5); }
.icon-green { background: rgba(16, 185, 129, 0.1); text-shadow: 0 2px 10px rgba(16, 185, 129, 0.5); }
.icon-red { background: rgba(239, 68, 68, 0.1); text-shadow: 0 2px 10px rgba(239, 68, 68, 0.5); }

.stat-info h3 { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; margin-bottom: 0.25rem; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: #fff; letter-spacing: -0.5px; }

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.section-header { margin-bottom: 1.5rem; }
.section-header h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.5px; }
.flex-header { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 1rem; }

/* Chart Section */
.chart-section { padding: 1.5rem; width: 100%; }
.chart-container { position: relative; height: 250px; width: 100%; margin-top: 1rem;}

/* Reviews Section */
.reviews-section { padding: 1.5rem; width: 100%; }

/* Robust Reviews Grid */
.reviews-grid { 
    display: grid !important; 
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important; 
    gap: 1.5rem !important; 
}

.review-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-light);
    border-radius: 16px; padding: 1.5rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}
.review-card:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.review-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; }
.review-author { display: flex; align-items: center; gap: 1rem; }
.author-avatar {
    width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
    border: 2px solid rgba(255,255,255,0.1);
}
.author-info h4 { font-size: 1rem; font-weight: 600; margin-bottom: 0.2rem; }
.author-stats { font-size: 0.75rem; color: var(--text-muted); display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;}

.review-rating { color: #facc15; font-size: 1rem; letter-spacing: 2px; text-shadow: 0 0 8px rgba(250, 204, 21, 0.4); margin-bottom: 0.75rem; }
.review-text { font-size: 0.95rem; line-height: 1.6; color: rgba(255,255,255,0.85); margin-bottom: 1rem; font-weight: 300; flex: 1;}

.review-photos { display: flex; gap: 0.5rem; margin-bottom: 1rem; overflow-x: auto; padding-bottom: 0.5rem; }
.review-photo { width: 80px; height: 80px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border-light); }

.owner-response {
    background: rgba(59, 130, 246, 0.05); border-left: 3px solid var(--accent);
    padding: 1rem; border-radius: 0 8px 8px 0; margin-bottom: 1rem;
}
.owner-response h5 { font-size: 0.85rem; color: var(--accent); margin-bottom: 0.5rem; }
.owner-response p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }

.review-footer { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; color: var(--text-muted); border-top: 1px solid var(--border-light); padding-top: 1rem; }
.likes-count { display: flex; align-items: center; gap: 0.4rem; background: rgba(255,255,255,0.05); padding: 0.3rem 0.8rem; border-radius: 20px; color: #fff;}

/* Review Action Buttons */
.review-actions {
    display: flex; gap: 0.5rem; margin-top: 1rem; padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}
.action-btn {
    display: flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.5rem 0.8rem; border-radius: 8px; font-size: 0.85rem; font-weight: 500;
    transition: all 0.2s ease; cursor: pointer; text-decoration: none; flex: 1;
}
.action-btn.reply-btn {
    background: rgba(59, 130, 246, 0.1); color: var(--accent);
    border: 1px solid rgba(59, 130, 246, 0.2);
}
.action-btn.reply-btn:hover { background: var(--accent); color: white; }
.action-btn.dm-btn {
    background: rgba(255, 255, 255, 0.05); color: var(--text-main);
    border: 1px solid var(--border-light);
}
.action-btn.dm-btn:hover { background: rgba(255, 255, 255, 0.1); }
.action-btn.report-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.action-btn.report-btn:hover { background: #ef4444; color: white; }

/* Tracker Table Styles */
.table-responsive { overflow-x: auto; width: 100%; border-radius: 12px; margin-top: 1rem; border: 1px solid var(--border-light); background: rgba(0,0,0,0.15); }
.tracker-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.9rem; }
.tracker-table th { background: rgba(255,255,255,0.05); padding: 1rem 1.25rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-size: 0.75rem; border-bottom: 1px solid var(--border-light); white-space: nowrap; }
.tracker-table td { padding: 1.25rem; border-bottom: 1px solid rgba(255,255,255,0.05); vertical-align: top; }
.tracker-table tr:last-child td { border-bottom: none; }
.tracker-table tr { transition: background 0.2s ease; }
.tracker-table tr:hover { background: rgba(255,255,255,0.03); }

/* Table specific overrides */
.tracker-table .review-author { gap: 0.75rem; }
.tracker-table .author-avatar { width: 36px; height: 36px; }
.tracker-table .author-info h4 { font-size: 0.95rem; }
.tracker-table .review-text { font-size: 0.9rem; margin-bottom: 0.5rem; -webkit-line-clamp: 3; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.tracker-table .owner-response { padding: 0.75rem; margin-bottom: 0; }
.tracker-table .review-actions { flex-direction: column; gap: 0.4rem; padding: 0; margin: 0; border: none; }
.tracker-table .action-btn { padding: 0.4rem 0.6rem; font-size: 0.8rem; }
.tracker-table .review-photos { margin-bottom: 0; padding-bottom: 0; flex-wrap: wrap; max-width: 220px; }
.tracker-table .review-photo { width: 48px; height: 48px; }

/* Badges & Filters */
.badge { padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-lg { background: rgba(245, 158, 11, 0.15); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }

/* Chart Tabs & Trends */
.chart-tabs { display: flex; background: rgba(0,0,0,0.3); border-radius: 8px; padding: 0.25rem; border: 1px solid var(--border-light); }
.tab-btn {
    background: transparent; border: none; color: var(--text-muted); padding: 0.4rem 1rem;
    border-radius: 6px; font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: all 0.3s;
}
.tab-btn:hover { color: #fff; }
.tab-btn.active { background: rgba(59, 130, 246, 0.2); color: var(--accent); font-weight: 600; }

.trend-badge {
    padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.75rem; font-weight: 700;
    display: inline-flex; align-items: center; gap: 0.25rem; letter-spacing: 0.5px;
}
.trend-positive { background: rgba(16, 185, 129, 0.15); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.trend-negative { background: rgba(239, 68, 68, 0.15); color: var(--error); border: 1px solid rgba(239, 68, 68, 0.2); }
.trend-neutral { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); border: 1px solid rgba(148, 163, 184, 0.2); }

/* Critical Alerts & Cards */
.alert-critical {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-left: 4px solid var(--error);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.alert-critical p { margin: 0; color: var(--error); font-weight: 500; font-size: 0.95rem; display: flex; align-items: center; gap: 0.5rem; }
.btn-critical {
    background: var(--error); color: #fff; border: none; padding: 0.5rem 1rem;
    border-radius: 6px; font-weight: 600; cursor: pointer; transition: all 0.3s;
}
.btn-critical:hover { background: #dc2626; }
.review-card.critical { border: 1px solid rgba(239, 68, 68, 0.4); box-shadow: 0 4px 20px rgba(239, 68, 68, 0.05); }

.filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filters-scrollable {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-top: 1rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.filters-scrollable::-webkit-scrollbar {
    display: none;
}
.filter-group {
    display: flex;
    gap: 0.5rem;
}
.filter-divider {
    width: 1px;
    height: 24px;
    background: var(--border-light);
}

.filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}
.filter-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.filter-btn.active { background: var(--accent); color: white; border-color: var(--accent); box-shadow: 0 4px 12px rgba(59,130,246,0.3); }

/* Loading Spinner */
.loading-spinner { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4rem 0; gap: 1rem; color: var(--text-muted); }
.spinner { width: 40px; height: 40px; border: 3px solid rgba(255,255,255,0.1); border-radius: 50%; border-top-color: var(--accent); animation: spin 1s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Settings Form overrides for Premium Look */
.settings-card { padding: 2.5rem; border-radius: 16px; max-width: 600px; }
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: var(--text-muted); font-size: 0.85rem; letter-spacing: 0.5px; }
.form-group input, .form-group select {
    width: 100%; padding: 1rem 1.25rem; background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255,255,255,0.05); border-radius: 12px; color: white; font-size: 1rem; transition: all 0.3s ease;
    font-family: 'Outfit', sans-serif;
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15); background: rgba(0,0,0,0.4); }
.form-group select option { background: var(--bg-primary); color: white; }
.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #6366f1); color: white;
    padding: 1rem 2rem; border-radius: 12px; font-weight: 600; border: none; cursor: pointer; transition: all 0.3s; box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5); }

@media (max-width: 768px) {
    .app-container { flex-direction: column; min-height: auto; }
    .sidebar { width: 100%; height: auto; position: relative; border-bottom: 1px solid var(--border-light); }
    .sidebar-header { padding: 1rem; text-align: center; border-bottom: none; }
    .sidebar-nav { flex-direction: row; padding: 0.5rem 1rem; overflow-x: auto; gap: 0.5rem; }
    .nav-item { padding: 0.5rem 0.75rem; white-space: nowrap; font-size: 0.85rem; }
    .nav-item svg { width: 16px; height: 16px; }
    
    .top-header { flex-direction: column; align-items: flex-start; gap: 1rem; padding: 1rem; }
    .top-header h1 { font-size: 1.2rem; }
    
    .content-wrapper { padding: 1rem; }
    .overview-grid { grid-template-columns: 1fr 1fr; gap: 1rem; }
    .stat-card { padding: 1rem; flex-direction: column; text-align: center; gap: 0.5rem; }
    .stat-icon { margin: 0 auto; }
    .stat-value { font-size: 1.5rem; }
    
    .dashboard-layout { gap: 1rem; }
    .flex-header { flex-direction: column; align-items: flex-start; }
    
    .chart-section, .reviews-section { padding: 1rem; }
    .chart-container { height: 200px; }
    
    .reviews-grid { grid-template-columns: 1fr !important; }
    .review-card { padding: 1rem; }
    
    .settings-card { padding: 1.5rem; margin: 1rem; }
    
    /* specific overrides for smaller phones */
    @media (max-width: 480px) {
        .overview-grid { grid-template-columns: 1fr; }
    }
}

/* Custom Checkbox */
.custom-checkbox {
    display: flex; align-items: center; gap: 0.75rem;
    position: relative; cursor: pointer; font-size: 0.9rem; color: #fff;
    margin-bottom: 0.75rem; user-select: none;
}
.custom-checkbox input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.custom-checkbox .checkmark {
    height: 20px; width: 20px; background-color: rgba(255,255,255,0.1); border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.2); transition: all 0.2s ease;
    display: flex; align-items: center; justify-content: center;
}
.custom-checkbox:hover input ~ .checkmark { background-color: rgba(255,255,255,0.15); }
.custom-checkbox input:checked ~ .checkmark { background-color: var(--accent); border-color: var(--accent); }
.custom-checkbox .checkmark:after {
    content: ""; display: none; width: 5px; height: 10px;
    border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg);
    margin-bottom: 2px;
}
.custom-checkbox input:checked ~ .checkmark:after { display: block; }
