/* ── UptimeGuard Dashboard Styles ── */
:root {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --border: #475569;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header .logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-header nav { display: flex; gap: 16px; align-items: center; }
.app-header nav a {
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}
.app-header nav a:hover, .app-header nav a.active {
    color: var(--text);
    background: var(--bg-input);
    text-decoration: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

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

.card-title {
    font-size: 18px;
    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);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    margin: 4px 0;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Monitor List ── */
.monitor-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.monitor-item:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.up { background: var(--success); box-shadow: 0 0 8px rgba(34,197,94,0.4); }
.status-dot.down { background: var(--danger); box-shadow: 0 0 8px rgba(239,68,68,0.4); }
.status-dot.paused { background: var(--text-muted); }
.status-dot.pending { background: var(--warning); }
.status-dot.maintenance { background: var(--info); }

.monitor-info { flex: 1; }
.monitor-name { font-weight: 600; font-size: 15px; }
.monitor-target { font-size: 13px; color: var(--text-muted); }

.monitor-stats {
    display: flex;
    gap: 24px;
    font-size: 13px;
    color: var(--text-muted);
}

.monitor-stats span strong {
    color: var(--text);
}

.uptime-bar {
    display: flex;
    gap: 2px;
    height: 28px;
    align-items: flex-end;
}

.uptime-bar .bar {
    width: 4px;
    border-radius: 2px;
    min-height: 4px;
    transition: height 0.3s;
}

.uptime-bar .bar.up { background: var(--success); }
.uptime-bar .bar.down { background: var(--danger); }
.uptime-bar .bar.unknown { background: var(--bg-input); }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-muted);
}

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-input); color: var(--text); }

/* ── Badge ── */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-up { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-down { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-paused { background: rgba(148,163,184,0.15); color: var(--text-muted); }
.badge-maintenance { background: rgba(6,182,212,0.15); color: var(--info); }

/* ── Modal ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
}

.modal h2 { margin-bottom: 20px; }

/* ── Table ── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; font-size: 14px; }
th { color: var(--text-muted); font-weight: 500; border-bottom: 1px solid var(--border); }
td { border-bottom: 1px solid rgba(71,85,105,0.3); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .monitor-stats { display: none; }
    .container { padding: 16px; }
}

/* ── Login Page ── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-card h1 {
    text-align: center;
    margin-bottom: 8px;
    color: var(--primary);
}

.login-card p {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ── Status Page (public) ── */
.status-header {
    text-align: center;
    padding: 40px 0;
}

.status-overall {
    display: inline-block;
    padding: 8px 24px;
    border-radius: 24px;
    font-size: 18px;
    font-weight: 600;
    margin-top: 12px;
}

.status-overall.operational { background: rgba(34,197,94,0.15); color: var(--success); }
.status-overall.partial { background: rgba(245,158,11,0.15); color: var(--warning); }
.status-overall.major { background: rgba(239,68,68,0.15); color: var(--danger); }

.status-monitor {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(71,85,105,0.3);
}

.status-monitor:last-child { border-bottom: none; }

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 300;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--success); color: white; }
.toast.error { background: var(--danger); color: white; }
