/* ─── CSS Variables ─── */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);
    --border: #334155;
    --radius: 0.75rem;
    --radius-sm: 0.5rem;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
    --transition: all 0.2s ease;
    --sidebar-width: 260px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ─── Utilities ─── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.text-muted { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.hidden { display: none; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.relative { position: relative; }

/* ─── Auth Layout ─── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1a1a2e 100%);
}
.auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.auth-card h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.auth-card .subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}
.auth-card .logo {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ─── Dashboard Layout ─── */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 40;
    transition: transform 0.3s ease;
}
.sidebar-logo {
    padding: 0 1.5rem;
    margin-bottom: 2rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sidebar-nav { list-style: none; }
.sidebar-nav li { margin-bottom: 0.125rem; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.03);
}
.sidebar-nav a.active {
    color: var(--accent);
    background: var(--info-bg);
    border-left-color: var(--accent);
}
.sidebar-nav .nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.sidebar-section {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
}

/* ─── Main Content ─── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}
.topbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar-left { display: flex; align-items: center; gap: 1rem; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.page-content { padding: 2rem; }
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

/* ─── Mobile menu button ─── */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
}

/* ─── Cards ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: var(--transition);
}
.card:hover { border-color: rgba(255,255,255,0.1); }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ─── Stat Cards ─── */
.stat-card { position: relative; overflow: hidden; }
.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
}
.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}
.stat-card .stat-icon {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}
.stat-icon.success { background: var(--success-bg); color: var(--success); }
.stat-icon.danger { background: var(--danger-bg); color: var(--danger); }
.stat-icon.warning { background: var(--warning-bg); color: var(--warning); }
.stat-icon.info { background: var(--info-bg); color: var(--info); }

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.btn-outline:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.75rem; font-size: 1rem; }
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
}
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
}
.btn-ghost:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }

/* ─── Forms ─── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}
.form-input, .form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}
.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.form-input::placeholder { color: var(--text-muted); }
.form-error {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 0.25rem;
}
.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ─── Tables ─── */
.table-wrapper { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: rgba(0,0,0,0.2);
}
td { font-size: 0.9rem; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ─── Badges ─── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: rgba(100,116,139,0.15); color: var(--text-secondary); }
.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}
.badge-dot.success { background: var(--success); }
.badge-dot.danger { background: var(--danger); }
.badge-dot.warning { background: var(--warning); }

/* ─── Alerts / Messages ─── */
.alert {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.alert-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(59,130,246,0.2); }

/* ─── Notification Bell ─── */
.notification-bell {
    position: relative;
    cursor: pointer;
}
.notification-bell .bell-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── Dropdown ─── */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    display: none;
    padding: 0.375rem 0;
    margin-top: 0.5rem;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    transition: var(--transition);
}
.dropdown-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}
.dropdown-divider {
    border-top: 1px solid var(--border);
    margin: 0.375rem 0;
}

/* ─── Empty State ─── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}
.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}
.empty-state h3 {
    font-size: 1.125rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* ─── Site Status Row ─── */
.site-row {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}
.site-row:hover { background: rgba(255,255,255,0.02); }
.site-row:last-child { border-bottom: none; }
.site-info { flex: 1; min-width: 0; }
.site-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.125rem;
}
.site-url {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.site-meta {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ─── Response Time Bar ─── */
.response-bar {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    width: 80px;
}
.response-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}
.response-bar-fill.fast { background: var(--success); }
.response-bar-fill.medium { background: var(--warning); }
.response-bar-fill.slow { background: var(--danger); }

/* ─── Pulse Animation ─── */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.animate-pulse { animation: pulse 2s ease-in-out infinite; }

/* ─── Responsive ─── */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .mobile-menu-btn { display: block; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .page-content { padding: 1rem; }
    .topbar { padding: 0.75rem 1rem; }
    .site-meta { display: none; }
}
@media (max-width: 480px) {
    .auth-card { padding: 1.5rem; }
}
