/* ================== Base ================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Vazirmatn", "Tahoma", "Segoe UI", sans-serif;
}

html {
    direction: rtl;
}

body {
    background: radial-gradient(circle at top, #111827, #020617);
    color: #e5e7eb;
    padding: 28px;
}

.dashboard {
    max-width: 1200px;
    margin: auto;
    padding: 20px;
}

/* ================== Header ================== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

header h1 {
    font-size: 28px;
    font-weight: 700;
}

header span {
    font-size: 13px;
    color: #94a3b8;
}

/* ================== KPI ================== */
.kpi {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.kpi-card {
    padding: 22px 24px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.06);
    transition: 0.25s ease;
}

.kpi-card b {
    display: block;
    font-size: 14px;
    color: #cbd5f5;
    margin-bottom: 6px;
}

.kpi-card strong {
    font-size: 40px;
    font-weight: 800;
}

.kpi-card small {
    font-size: 13px;
    color: #94a3b8;
}

.kpi-card.normal { border-right: 5px solid #22c55e; }
.kpi-card.degraded { border-right: 5px solid #facc15; }
.kpi-card.severe { border-right: 5px solid #ef4444; }

/* ================== Chart ================== */
.chart-card {
    margin-bottom: 30px;
    padding: 22px;
    border-radius: 18px;
    background: rgba(255,255,255,0.04);
    box-shadow: 0 8px 26px rgba(0,0,0,0.25);
}

.chart-card h2 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #e2e8f0;
}

.chart-card svg {
    width: 100%;
    height: 180px;
    display: block;
}

/* Time labels */
.time-labels {
    position: relative;
    width: 100%;
    height: 14px;
    margin-top: 6px;
}

.time-labels span {
    position: absolute;
    font-size: 10px;
    color: #94a3b8;
    transform: translateX(-50%);
}

/* ================== Services ================== */
.services {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.service {
    padding: 16px 18px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(2,6,23,0.9), rgba(2,6,23,0.7));
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 6px 18px rgba(0,0,0,0.35);
}

.service span {
    font-size: 15px;
}

.service b {
    font-size: 14px;
    white-space: nowrap;
}

.service.up { border-right: 4px solid #22c55e; }
.service.down { border-right: 4px solid #ef4444; opacity: .75; }

/* ================== API Docs ================== */
.api-docs {
    margin-top: 40px;
}

.api-docs h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #e2e8f0;
}

.api-docs p {
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 18px;
}

.api-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.api-card {
    background: rgba(255,255,255,0.04);
    padding: 16px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.api-header {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.api-endpoint {
    font-weight: 600;
    color: #22c55e;
    word-break: break-all;
}

.api-method {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(34,197,94,0.15);
    color: #94a3b8;
}

.api-desc {
    font-size: 13px;
    color: #cbd5f5;
    margin-bottom: 8px;
}

.api-card pre {
    background: #111827;
    padding: 10px;
    border-radius: 12px;
    font-size: 12px;
    overflow-x: auto;
    color: #d1d5db;
    white-space: pre-wrap;
}

/* ================== Footer ================== */
footer {
    margin-top: 32px;
    text-align: center;
    font-size: 13px;
    color: #94a3b8;
}

footer code {
    background: rgba(255,255,255,0.06);
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
}

/* ================== Mobile Fixes ================== */
@media (max-width: 640px) {

    body {
        padding: 14px;
    }

    .dashboard {
        padding: 12px;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    header h1 {
        font-size: 22px;
        line-height: 1.4;
    }

    .kpi {
        grid-template-columns: 1fr;
    }

    .kpi-card strong {
        font-size: 32px;
    }

    .services {
        grid-template-columns: 1fr;
    }

    .chart-card svg {
        height: 130px;
    }

    .api-cards {
        grid-template-columns: 1fr;
    }

    .api-card pre {
        font-size: 11px;
    }
}
