
:root {
    --raf-purple: #71368a;
    --raf-purple-dark: #51235f;
    --raf-purple-light: #9552ad;

    --raf-gold: #f4ad2f;
    --raf-gold-dark: #d58d12;

    --bg: #f4f1f6;
    --surface: #ffffff;
    --surface-soft: #faf8fb;

    --text: #251f28;
    --muted: #756d79;
    --border: #e5dfe7;

    --success: #2f9d5d;
    --warning: #e59c21;
    --danger: #cf4f4f;

    --shadow: 0 5px 18px rgba(74, 37, 87, 0.10);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Calibri, Arial, sans-serif;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    direction: rtl;
    background:
        linear-gradient(
            180deg,
            rgba(113, 54, 138, 0.06),
            transparent 210px
        ),
        var(--bg);

    color: var(--text);
}

/* =========================
   الشريط العلوي
========================= */

.topbar {
    height: 82px;
    padding: 9px 28px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    background:
        linear-gradient(
            115deg,
            var(--raf-purple-dark),
            var(--raf-purple),
            var(--raf-purple-light)
        );

    color: white;
    border-bottom: 4px solid var(--raf-gold);

    box-shadow: 0 4px 15px rgba(68, 28, 81, 0.20);
}

.brand-area {
    display: flex;
    align-items: center;
    gap: 13px;
}

.company-logo {
    width: 150px;
    height: 58px;

    object-fit: contain;

    padding: 5px 10px;

    border-radius: 11px;

    background: white;

    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.14);
}

.brand-text h1 {
    font-size: 23px;
    line-height: 1.1;
}

.brand-text p {
    margin-top: 4px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.88);
}

.system-title {
    direction: ltr;

    color: var(--raf-gold);

    font-size: 19px;
    font-weight: 700;
    letter-spacing: 0.8px;
}

/* =========================
   الحاوية الرئيسية
========================= */

.dashboard-container {
    height: calc(100vh - 82px);
    width: 100%;

    padding: 10px 18px 12px;

    display: grid;

    grid-template-rows:
        auto
        auto
        auto
        minmax(0, 1fr);

    gap: 9px;

    overflow: hidden;
}

/* =========================
   شريط المطار
========================= */

.airport-toolbar {
    min-height: 62px;

    display: grid;
    grid-template-columns: 1.25fr 2fr auto;
    align-items: center;
    gap: 14px;

    padding: 8px 12px;

    background: rgba(255, 255, 255, 0.88);

    border: 1px solid var(--border);
    border-radius: 12px;

    box-shadow: var(--shadow);
}

.page-title h2 {
    color: var(--raf-purple-dark);
    font-size: 21px;
    line-height: 1.15;
}

.page-title p {
    margin-top: 4px;

    color: var(--muted);
    font-size: 12px;
}

.airport-buttons {
    display: grid;
    grid-template-columns: repeat(5, minmax(90px, 1fr));
    gap: 7px;
}

.airport-button {
    min-height: 43px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;

    padding: 5px 8px;

    background: white;
    color: var(--raf-purple-dark);

    border: 1px solid var(--border);
    border-radius: 9px;

    text-decoration: none;
    font-weight: 700;
    font-size: 13px;

    transition: 0.18s ease;
}

.airport-button:hover {
    border-color: var(--raf-purple);
    transform: translateY(-1px);
}

.airport-button.active {
    color: white;

    background:
        linear-gradient(
            135deg,
            var(--raf-purple-dark),
            var(--raf-purple)
        );

    border-color: var(--raf-purple);
    box-shadow: 0 4px 10px rgba(113, 54, 138, 0.22);
}

.airport-icon {
    font-size: 15px;
}

.airport-button small {
    opacity: 0.75;
    font-size: 10px;
}

.refresh-button {
    min-width: 76px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: white;
    background:
        linear-gradient(
            135deg,
            var(--raf-gold),
            var(--raf-gold-dark)
        );

    border-radius: 9px;

    text-decoration: none;
    font-weight: 700;
    font-size: 13px;

    box-shadow: 0 4px 10px rgba(213, 141, 18, 0.23);
}

/* =========================
   بطاقات الإجماليات
========================= */

.summary-cards {
    display: grid;
    grid-template-columns: repeat(8, minmax(110px, 1fr));
    gap: 8px;
}

.summary-card {
    min-height: 68px;

    position: relative;
    overflow: hidden;

    padding: 10px 12px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-top: 3px solid var(--raf-purple);

    border-radius: 10px;

    box-shadow: var(--shadow);
}

.summary-card::after {
    content: "";

    position: absolute;
    left: -18px;
    bottom: -28px;

    width: 70px;
    height: 70px;

    border-radius: 50%;

    background: rgba(113, 54, 138, 0.05);
}

.summary-card span {
    display: block;

    color: var(--muted);
    font-size: 12px;

    margin-bottom: 4px;
}

.summary-card strong {
    position: relative;
    z-index: 2;

    color: var(--raf-purple-dark);

    font-size: 25px;
    line-height: 1;
}

.warning-card {
    border-top-color: var(--warning);
}

.danger-card {
    border-top-color: var(--danger);
}

.demand-summary-card {
    color: white;

    background:
        linear-gradient(
            135deg,
            var(--raf-purple-dark),
            var(--raf-purple)
        );

    border-top-color: var(--raf-gold);
}

.demand-summary-card span,
.demand-summary-card strong,
.demand-summary-card small {
    color: white;
}

.demand-summary-card div {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

/* =========================
   شريط توقع الطلب
========================= */

.demand-strip {
    min-height: 47px;

    display: grid;
    grid-template-columns: 1fr 1fr 0.8fr 2fr;
    align-items: center;
    gap: 8px;

    padding: 7px 10px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 10px;

    box-shadow: var(--shadow);
}

.demand-strip-item {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 8px;

    padding: 0 9px;

    border-left: 1px solid var(--border);
}

.demand-strip-item:last-of-type {
    border-left: none;
}

.demand-strip-item span {
    color: var(--muted);
    font-size: 12px;
}

.demand-strip-item strong {
    color: var(--raf-purple-dark);
    font-size: 16px;
}

.demand-strip-item small {
    font-size: 11px;
}

.demand-level-item strong {
    color: var(--raf-gold-dark);
}

.demand-progress-wrapper {
    padding: 0 8px;
}

.demand-progress {
    height: 12px;

    overflow: hidden;

    background: #ebe5ed;

    border-radius: 20px;
}

.demand-progress-bar {
    height: 100%;

    background:
        linear-gradient(
            90deg,
            var(--raf-purple),
            var(--raf-gold)
        );

    border-radius: 20px;
}

/* =========================
   منطقة الجداول
========================= */

.flight-sections {
    min-height: 0;

    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;

    overflow: hidden;
}

.flight-panel {
    min-width: 0;
    min-height: 0;

    display: grid;
    grid-template-rows: auto minmax(0, 1fr);

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 11px;

    box-shadow: var(--shadow);

    overflow: hidden;
}

.flight-panel-header {
    min-height: 48px;

    padding: 7px 12px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 10px;

    border-bottom: 1px solid var(--border);

    background:
        linear-gradient(
            90deg,
            rgba(113, 54, 138, 0.08),
            rgba(244, 173, 47, 0.06)
        );
}

.flight-panel-header h3 {
    color: var(--raf-purple-dark);
    font-size: 17px;
}

.flight-panel-header span {
    display: block;

    margin-top: 2px;

    color: var(--muted);
    font-size: 11px;
}

.flight-panel-header strong {
    color: var(--raf-gold-dark);
    font-size: 12px;
    white-space: nowrap;
}

.compact-table-wrapper {
    min-height: 0;
    width: 100%;

    overflow: auto;
}

.compact-flight-table {
    width: 100%;
    min-width: 900px;

    border-collapse: collapse;
    table-layout: auto;
}

.compact-flight-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

.compact-flight-table th {
    padding: 8px 6px;

    color: white;

    background:
        linear-gradient(
            135deg,
            var(--raf-purple-dark),
            var(--raf-purple)
        );

    border-left: 1px solid rgba(255, 255, 255, 0.12);

    font-size: 11px;
    text-align: center;
    white-space: nowrap;
}

.compact-flight-table td {
    padding: 7px 6px;

    border-bottom: 1px solid #eee9f0;

    font-size: 11px;
    text-align: center;
    white-space: nowrap;
}

.compact-flight-table tbody tr:nth-child(even) {
    background: var(--surface-soft);
}

.compact-flight-table tbody tr:hover {
    background: rgba(113, 54, 138, 0.065);
}

.compact-flight-table td strong {
    color: var(--text);
    font-size: 11px;
}

.compact-flight-table td small {
    margin-right: 3px;

    color: var(--muted);
    font-size: 9px;
}

.flight-number {
    direction: ltr;
    font-weight: 700;
    color: var(--raf-purple-dark);
}

.status-badge{
    display:inline-flex;
    justify-content:center;
    align-items:center;

    width:44px;
    height:18px;

    padding:0;

    font-size:9px;
    font-weight:700;

    border-radius:10px;

    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;

    background:rgba(113,54,138,.10);
    color:var(--raf-purple-dark);
}

.delay-value {
    display: inline-block;

    min-width: 44px;

    padding: 3px 6px;

    color: #9a5b00;
    background: rgba(244, 173, 47, 0.18);

    border-radius: 12px;

    font-weight: 700;
}

.no-delay {
    color: var(--muted);
}

.empty-table {
    padding: 25px !important;

    color: var(--muted);

    text-align: center !important;
}

.api-error {
    padding: 7px 10px;

    color: #8a2929;
    background: #ffe7e7;

    border: 1px solid #f3bcbc;
    border-radius: 8px;

    font-size: 12px;
}

/* =========================
   Scroll داخلي
========================= */

.compact-table-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.compact-table-wrapper::-webkit-scrollbar-track {
    background: #eee9f0;
}

.compact-table-wrapper::-webkit-scrollbar-thumb {
    background: var(--raf-purple-light);
    border-radius: 10px;
}

.compact-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--raf-purple);
}

/* =========================
   الشاشات الأصغر
========================= */

@media (max-width: 1450px) {
    .system-title {
        font-size: 17px;
    }

    .summary-card strong {
        font-size: 22px;
    }

    .summary-card span {
        font-size: 11px;
    }

    .airport-button {
        font-size: 12px;
    }
}

@media (max-width: 1150px) {
    html,
    body {
        overflow: auto;
    }

    .dashboard-container {
        height: auto;
        overflow: visible;
    }

    .airport-toolbar {
        grid-template-columns: 1fr;
    }

    .summary-cards {
        grid-template-columns: repeat(4, 1fr);
    }

    .flight-sections {
        grid-template-columns: 1fr;
        overflow: visible;
    }

    .flight-panel {
        height: 500px;
    }
}