/* ===== Base Reset & Typography ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f7fa;
    color: #1a1a2e;
    line-height: 1.6;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Layout ===== */
.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }
.navbar {
    background: #1a1a2e;
    color: #fff;
    padding: 14px 0;
    margin-bottom: 32px;
}
.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.navbar .brand { font-size: 1.2rem; font-weight: 700; color: #fff; }
.navbar .brand:hover { text-decoration: none; }
.navbar .nav-links a {
    color: #cbd5e1;
    margin-left: 20px;
    font-size: 0.9rem;
}
.navbar .nav-links a:hover { color: #fff; text-decoration: none; }

/* ===== Public Status Page ===== */
.status-header {
    text-align: center;
    margin-bottom: 32px;
}
.status-header h1 { font-size: 1.8rem; margin-bottom: 4px; }
.status-header p { color: #64748b; font-size: 0.95rem; }

.all-operational {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    padding: 14px 20px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    margin-bottom: 24px;
}
.has-issues {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.status-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.status-card {
    background: #fff;
    border-radius: 8px;
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #e2e8f0;
    transition: box-shadow 0.2s;
}
.status-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

.status-card .site-info h3 { font-size: 1rem; font-weight: 600; }
.status-card .site-info .url { color: #94a3b8; font-size: 0.8rem; }

.status-card .site-status { text-align: right; }
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-up { background: #d1fae5; color: #065f46; }
.badge-down { background: #fee2e2; color: #991b1b; }
.badge-unknown { background: #f1f5f9; color: #64748b; }

.status-meta {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-top: 4px;
}

.last-updated {
    text-align: center;
    color: #94a3b8;
    font-size: 0.82rem;
    margin-top: 28px;
    padding-bottom: 40px;
}

/* ===== Flash Messages ===== */
.flash {
    padding: 12px 18px;
    border-radius: 6px;
    margin-bottom: 18px;
    font-size: 0.9rem;
}
.flash-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ===== Login Page ===== */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}
.login-box {
    background: #fff;
    padding: 36px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    width: 100%;
    max-width: 380px;
}
.login-box h2 { margin-bottom: 22px; text-align: center; }
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: #475569;
}
.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.95rem;
}
.form-group input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.btn-primary { background: #2563eb; color: #fff; width: 100%; }
.btn-primary:hover { background: #1d4ed8; }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-secondary { background: #e2e8f0; color: #475569; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-success { background: #10b981; color: #fff; }
.btn-success:hover { background: #059669; }

/* ===== Admin Dashboard ===== */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.admin-header h1 { font-size: 1.5rem; }

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}
.stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}
.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
}
.stat-card .stat-label {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stat-up .stat-value { color: #059669; }
.stat-down .stat-value { color: #dc2626; }

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    margin-bottom: 32px;
}
th, td { padding: 12px 16px; text-align: left; }
th {
    background: #f8fafc;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
}
td { border-bottom: 1px solid #f1f5f9; font-size: 0.9rem; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

.actions-cell { white-space: nowrap; }
.actions-cell form { display: inline; }
.actions-cell .btn { margin-left: 4px; }

/* ===== Add/Edit Modal-style Form ===== */
.form-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}
.form-card h3 { margin-bottom: 16px; }
.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}
.form-row .form-group { flex: 1; margin-bottom: 0; }
.form-row .btn { height: 41px; }

.disabled-row { opacity: 0.5; }

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .form-row { flex-direction: column; }
    .form-row .btn { width: 100%; }
    .admin-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .actions-cell .btn { display: block; margin: 2px 0; }
}
