
* {
    box-sizing: border-box;
}

:root {
    --bg: #0b1120;
    --surface: #111827;
    --surface-2: #172033;
    --border: #263247;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --accent: #38bdf8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(56, 189, 248, 0.08), transparent 30%),
        var(--bg);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 40px;
}

/* Header */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 24px 28px;
    margin-bottom: 18px;
    background: rgba(17, 24, 39, 0.88);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.header h1 {
    margin: 0;
    font-size: clamp(1.7rem, 4vw, 2.35rem);
    letter-spacing: -0.03em;
}

.header p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 0.98rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

#languageButton {
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    padding: 9px 15px;
    border-radius: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.2s ease;
}

#languageButton:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

/* Status */

.status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 13px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
}

.status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 10px currentColor;
}

.status.online {
    color: var(--success);
    background: rgba(34, 197, 94, 0.10);
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.status.offline {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.10);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Last update */

.last-update {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0 4px 26px;
}

.last-update strong {
    color: var(--text);
    font-weight: 600;
}

/* Sections */

section {
    margin-bottom: 28px;
}

section h2 {
    margin: 0 0 13px;
    font-size: 1.15rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}

/* Metric cards */

.cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.card {
    position: relative;
    overflow: hidden;
    min-height: 112px;
    padding: 20px;
    background: linear-gradient(145deg, var(--surface), var(--surface-2));
    border: 1px solid var(--border);
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.card::after {
    content: "";
    position: absolute;
    width: 80px;
    height: 80px;
    right: -30px;
    bottom: -35px;
    border-radius: 50%;
    background: rgba(56, 189, 248, 0.07);
}

.card:hover {
    transform: translateY(-2px);
    border-color: #34435c;
}

.card span {
    display: block;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 0.88rem;
}

.card strong {
    display: block;
    color: var(--text);
    font-size: clamp(1.45rem, 3vw, 1.85rem);
    font-weight: 700;
    letter-spacing: -0.025em;
}

/* Charts */

.chart-placeholder {
    position: relative;
    width: 100%;
    height: 300px;
    padding: 18px;
    background: linear-gradient(145deg, var(--surface), var(--surface-2));
    border: 1px solid var(--border);
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.chart-placeholder canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Footer */

footer {
    padding: 26px 0 4px;
    color: var(--muted);
    text-align: center;
    font-size: 0.85rem;
}

/* Responsive */

@media (max-width: 800px) {
    .container {
        width: min(100% - 22px, 680px);
        padding-top: 18px;
    }

    .header {
        align-items: flex-start;
        flex-direction: column;
        padding: 20px;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chart-placeholder {
        height: 260px;
    }
}

@media (max-width: 520px) {
    .cards {
        grid-template-columns: 1fr;
    }

    .card {
        min-height: 96px;
    }

    .chart-placeholder {
        height: 230px;
        padding: 10px;
    }

    section h2 {
        font-size: 1.05rem;
    }
}
/* Persian RTL */

html[dir="rtl"] body {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .header {
    text-align: right;
}

html[dir="rtl"] .header-actions {
    flex-direction: row-reverse;
}

html[dir="rtl"] .last-update {
    text-align: right;
}

html[dir="rtl"] section h2 {
    text-align: right;
}

html[dir="rtl"] .card {
    text-align: right;
}

html[dir="rtl"] footer {
    text-align: center;
}

.chart-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.chart-controls span {
    color: var(--muted);
    font-size: 0.9rem;
}

.chart-controls button {
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--muted);
    padding: 7px 13px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: 0.2s ease;
}

.chart-controls button:hover {
    border-color: var(--accent);
    color: var(--text);
}

.chart-controls button.active {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
    font-weight: 700;
}

html[dir="rtl"] .chart-controls {
    direction: rtl;
    flex-direction: row;
    justify-content: flex-start;
}

.status.online {
    color: #22c55e;
}

.status.offline {
    color: #ef4444;
}
