/* ============================================
   DASHBOARD - Cyberlian Analytics (Flat Clean)
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --bg: #f8f9fa;
    --surface: #ffffff;
    --border: #e5e7eb;
    --text: #1a1a1a;
    --text-light: #333;
    --text-muted: #6c757d;
    --accent: #ea5a0b;
    --accent-light: #fef3ed;
}
body.dark {
    --bg: #0a0a0a;
    --surface: #1a1a1a;
    --border: #2d2d2d;
    --text: #e5e7eb;
    --text-light: #d1d5db;
    --text-muted: #9ca3af;
    --accent-light: #2d1a1a;
}
body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.3s, color 0.3s;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease;
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }
.loading-spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
    margin-top: 8px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Header */
.dashboard-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.header-left .logo {
    font-size: 1rem;
    font-weight: 800;
}
.header-left .logo .highlight { color: var(--accent); }
.header-left .sub {
    font-size: 0.5rem;
    color: var(--text-muted);
    font-weight: 500;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.header-right .last-updated {
    font-size: 0.5rem;
    color: var(--text-muted);
}
.header-right .sign-out-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    transition: color 0.2s;
    padding: 4px 6px;
}
.header-right .sign-out-btn:hover { color: var(--accent); }
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
    -webkit-tap-highlight-color: transparent;
}
@media (max-width: 768px) {
    .mobile-menu-toggle { display: block; }
    .header-left .sub { display: none; }
}
@media (min-width: 769px) {
    .mobile-menu-toggle { display: none !important; }
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    z-index: 200;
    padding: 50px 16px 16px;
    transition: left 0.3s ease;
    overflow-y: auto;
}
.mobile-menu.open { left: 0; }
.mobile-menu .menu-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--text);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.mobile-menu a {
    display: block;
    padding: 10px 0;
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.mobile-menu a:hover { color: var(--accent); }
.mobile-menu a.active { color: var(--accent); font-weight: 600; }
.mobile-menu .sign-out-link {
    margin-top: 12px;
    color: var(--accent);
    font-weight: 600;
    border-bottom: none;
    padding: 10px 0;
}
.mobile-menu .sign-out-link:hover { color: var(--accent); opacity: 0.8; }
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 150;
}
.mobile-overlay.active { display: block; }
@media (min-width: 769px) {
    .mobile-menu { display: none !important; }
    .mobile-overlay { display: none !important; }
}

/* Container */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px 12px 30px;
}

/* Stats Grid – NO SHADOW, clean border */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 10px 12px;
    text-align: center;
}
.stat-card .number {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent);
}
.stat-card .label {
    font-size: 0.5rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 2px;
}

/* Charts Grid – clean, no shadow */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 10px 14px;
}
.chart-card h3 {
    font-size: 0.55rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}
.chart-card canvas { max-height: 140px; width: 100%; }
.chart-card.full-width { grid-column: 1 / -1; }

/* IP & Pages Grid – clean */
.ip-pages-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.list-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 10px 14px;
}
.list-card h3 {
    font-size: 0.55rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}
.list-card .list-item {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.65rem;
    color: var(--text-light);
}
.list-card .list-item .value {
    font-weight: 600;
    color: var(--accent);
}
.empty-state {
    text-align: center;
    padding: 16px 0;
    color: var(--text-muted);
    font-size: 0.65rem;
}
.empty-state i {
    font-size: 1rem;
    color: var(--accent);
    opacity: 0.2;
    display: block;
    margin-bottom: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .charts-grid { grid-template-columns: 1fr; }
    .ip-pages-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .container { padding: 12px 8px 24px; }
    .stat-card .number { font-size: 1.2rem; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
    .stat-card { padding: 8px 10px; }
    .stat-card .number { font-size: 1rem; }
}