/* ============================================================
   PMS Analytics Dashboard - CSS
   ============================================================ */

/* ---- Blazor Native Dropdown ---- */
.pms-blazor-dropdown {
    position: relative;
    display: inline-block;
}

.pms-blazor-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 1055;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.13);
    min-width: 180px;
    padding: 6px 0;
    animation: dropFadeIn 0.15s ease;
}

@keyframes dropFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pms-blazor-dropdown-menu li {
    list-style: none;
    padding: 9px 16px;
    cursor: pointer;
    font-size: 0.87rem;
    color: #1e293b;
    transition: background 0.12s;
    border-radius: 6px;
    margin: 1px 4px;
}

.pms-blazor-dropdown-menu li:hover {
    background: #f0f7ff;
    color: #2563a8;
}

/* ---- Page ---- 
.pms-analytics-page {
    direction: rtl;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 16px;
    background: #f4f6fb;
    min-height: 100vh;
}

/* ---- Header ---- */
.analytics-header {
    background: linear-gradient(135deg, #0f2c55 0%, #1a4a8a 50%, #2563a8 100%);
    color: #fff;
    border-radius: 14px;
    padding: 22px 28px;
    margin-bottom: 20px;
    box-shadow: 0 6px 20px rgba(37,99,168,0.3);
}

.analytics-header-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}

.analytics-header-sub {
    opacity: 0.85;
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* ---- Filter Bar ---- */
.analytics-filter-bar {
    background: #fff;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}

.analytics-filter-bar label {
    font-weight: 600;
    font-size: 0.82rem;
    color: #555;
    display: block;
    margin-bottom: 4px;
}

.analytics-city-drop .dropdown-menu {
    z-index: 1050;
}

/* ---- Loading / Empty ---- */
.analytics-loading {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 1rem;
}

.analytics-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 1.1rem;
    background: #fff;
    border-radius: 12px;
}

/* ---- KPI Cards ---- */
.analytics-kpi-card {
    display: flex;
    align-items: center;
    gap: 14px;
    border-radius: 14px;
    padding: 16px 18px;
    color: #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    transition: transform 0.2s, box-shadow 0.2s;
    min-height: 90px;
}

.analytics-kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(0,0,0,0.18);
}

.analytics-kpi-icon {
    font-size: 2rem;
    opacity: 0.9;
    flex-shrink: 0;
}

.analytics-kpi-body { flex: 1; }

.analytics-kpi-value {
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 2px;
}

.analytics-kpi-label {
    font-size: 0.78rem;
    opacity: 0.9;
    font-weight: 600;
}

.analytics-kpi-sub {
    font-size: 0.7rem;
    opacity: 0.75;
    margin-top: 2px;
}

.kpi-blue    { background: linear-gradient(135deg, #2563a8, #3b82f6); }
.kpi-green   { background: linear-gradient(135deg, #059669, #10b981); }
.kpi-orange  { background: linear-gradient(135deg, #d97706, #f59e0b); }
.kpi-red     { background: linear-gradient(135deg, #dc2626, #ef4444); }
.kpi-teal    { background: linear-gradient(135deg, #0891b2, #06b6d4); }
.kpi-purple  { background: linear-gradient(135deg, #7c3aed, #8b5cf6); }

/* ---- Chart Cards ---- */
.analytics-chart-card {
    background: #fff;
    border-radius: 14px;
    padding: 18px 16px 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    height: 100%;
    page-break-inside: avoid;
    break-inside: avoid;
}

.analytics-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.analytics-chart-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.analytics-chart-badge {
    background: #eff6ff;
    color: #2563a8;
    border: 1px solid #bfdbfe;
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 0.72rem;
    font-weight: 700;
}

.analytics-chart-desc {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 6px;
    text-align: center;
}

/* ---- Insight Cards ---- */
.analytics-insight-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    transition: transform 0.2s;
}

.analytics-insight-card:hover { transform: translateY(-2px); }

.insight-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
}

.insight-gold   { background: #fef3c7; }
.insight-blue   { background: #eff6ff; }
.insight-teal   { background: #ecfeff; }
.insight-green  { background: #d1fae5; }
.insight-red    { background: #fee2e2; }
.insight-orange { background: #fff7ed; }

.insight-body { flex: 1; min-width: 0; }

.insight-title {
    font-size: 0.78rem;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 2px;
}

.insight-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.insight-subtitle {
    font-size: 0.73rem;
    color: #94a3b8;
    margin-top: 1px;
}

/* ---- Section Title ---- */
.analytics-section-header {
    border-right: 4px solid #2563a8;
    padding-right: 12px;
}

.analytics-section-header h5 {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.analytics-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e2e8f0;
}

/* ---- Summary Table ---- */
.analytics-summary-table-wrap {
    background: #fff;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    margin-bottom: 24px;
}

.analytics-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.analytics-summary-table th {
    background: #f8fafc;
    padding: 10px 14px;
    font-weight: 700;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
    text-align: right;
}

.analytics-summary-table td {
    padding: 9px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #374151;
    text-align: right;
}

.analytics-summary-table tr:hover td { background: #f8fafc; }

.analytics-summary-total td {
    font-weight: 700;
    background: #f0f7ff !important;
    color: #1e293b;
}

/* ---- Data Table ---- */
.analytics-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.analytics-data-table th {
    background: #1e3a5f;
    color: #fff;
    padding: 10px 10px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.analytics-data-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
    text-align: center;
    color: #374151;
}

.analytics-data-table tbody tr:hover td { background: #f0f7ff; }
.analytics-data-table tbody tr:nth-child(even) td { background: #f8fafc; }
.analytics-data-table tbody tr:nth-child(even):hover td { background: #e8f0fe; }

.analytics-row-clickable { cursor: pointer; }

/* ============================================================
   Print Styles
============================================================ */
.analytics-print-page {
    direction: rtl;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.print-kpi-box {
    border-radius: 10px;
    padding: 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    text-align: center;
}

.print-kpi-val {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1e40af;
}

.print-kpi-lbl {
    font-size: 0.78rem;
    color: #3b82f6;
    font-weight: 600;
}

.print-kpi-green { background: #d1fae5; border-color: #6ee7b7; }
.print-kpi-green .print-kpi-val { color: #065f46; }
.print-kpi-green .print-kpi-lbl { color: #059669; }

.print-kpi-orange { background: #fff7ed; border-color: #fed7aa; }
.print-kpi-orange .print-kpi-val { color: #92400e; }
.print-kpi-orange .print-kpi-lbl { color: #d97706; }

.print-kpi-red { background: #fee2e2; border-color: #fca5a5; }
.print-kpi-red .print-kpi-val { color: #991b1b; }
.print-kpi-red .print-kpi-lbl { color: #dc2626; }

@media print {
    /* ---- Hide UI elements ---- */
    .no-print { display: none !important; }
    .pms-loading, .analytics-empty { display: none; }
    .pms-blazor-dropdown { display: none !important; }

    /* ---- Page setup ---- */
    @page { size: A4 landscape; margin: 1.2cm; }
    body { background: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

    /* ---- Force Bootstrap 4 grid to stay side by side ---- */
    .row {
        display: flex !important;
        flex-wrap: wrap !important;
        margin-right: -8px !important;
        margin-left: -8px !important;
    }
    [class*="col-"] {
        padding-right: 8px !important;
        padding-left: 8px !important;
        box-sizing: border-box !important;
    }
    .col-1  { flex: 0 0 8.333%   !important; max-width: 8.333%   !important; }
    .col-2  { flex: 0 0 16.666%  !important; max-width: 16.666%  !important; }
    .col-3  { flex: 0 0 25%      !important; max-width: 25%      !important; }
    .col-4  { flex: 0 0 33.333%  !important; max-width: 33.333%  !important; }
    .col-5  { flex: 0 0 41.666%  !important; max-width: 41.666%  !important; }
    .col-6  { flex: 0 0 50%      !important; max-width: 50%      !important; }
    .col-7  { flex: 0 0 58.333%  !important; max-width: 58.333%  !important; }
    .col-8  { flex: 0 0 66.666%  !important; max-width: 66.666%  !important; }
    .col-9  { flex: 0 0 75%      !important; max-width: 75%      !important; }
    .col-10 { flex: 0 0 83.333%  !important; max-width: 83.333%  !important; }
    .col-11 { flex: 0 0 91.666%  !important; max-width: 91.666%  !important; }
    .col-12 { flex: 0 0 100%     !important; max-width: 100%     !important; }

    .col-md-1  { flex: 0 0 8.333%   !important; max-width: 8.333%   !important; }
    .col-md-2  { flex: 0 0 16.666%  !important; max-width: 16.666%  !important; }
    .col-md-3  { flex: 0 0 25%      !important; max-width: 25%      !important; }
    .col-md-4  { flex: 0 0 33.333%  !important; max-width: 33.333%  !important; }
    .col-md-5  { flex: 0 0 41.666%  !important; max-width: 41.666%  !important; }
    .col-md-6  { flex: 0 0 50%      !important; max-width: 50%      !important; }
    .col-md-7  { flex: 0 0 58.333%  !important; max-width: 58.333%  !important; }
    .col-md-8  { flex: 0 0 66.666%  !important; max-width: 66.666%  !important; }
    .col-md-9  { flex: 0 0 75%      !important; max-width: 75%      !important; }
    .col-md-10 { flex: 0 0 83.333%  !important; max-width: 83.333%  !important; }
    .col-md-11 { flex: 0 0 91.666%  !important; max-width: 91.666%  !important; }
    .col-md-12 { flex: 0 0 100%     !important; max-width: 100%     !important; }

    .col-lg-1  { flex: 0 0 8.333%   !important; max-width: 8.333%   !important; }
    .col-lg-2  { flex: 0 0 16.666%  !important; max-width: 16.666%  !important; }
    .col-lg-3  { flex: 0 0 25%      !important; max-width: 25%      !important; }
    .col-lg-4  { flex: 0 0 33.333%  !important; max-width: 33.333%  !important; }
    .col-lg-5  { flex: 0 0 41.666%  !important; max-width: 41.666%  !important; }
    .col-lg-6  { flex: 0 0 50%      !important; max-width: 50%      !important; }
    .col-lg-7  { flex: 0 0 58.333%  !important; max-width: 58.333%  !important; }
    .col-lg-8  { flex: 0 0 66.666%  !important; max-width: 66.666%  !important; }
    .col-lg-9  { flex: 0 0 75%      !important; max-width: 75%      !important; }
    .col-lg-10 { flex: 0 0 83.333%  !important; max-width: 83.333%  !important; }
    .col-lg-11 { flex: 0 0 91.666%  !important; max-width: 91.666%  !important; }
    .col-lg-12 { flex: 0 0 100%     !important; max-width: 100%     !important; }

    /* ---- Chart cards ---- */
    .analytics-chart-card {
        box-shadow: none !important;
        border: 1px solid #d1d5db !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* ---- Row: keep together, avoid break ---- */
    .row.mb-4 { page-break-inside: avoid; break-inside: avoid; }

    /* ---- Header colors ---- */
    .analytics-header {
        background: #1e3a5f !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .print-header {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* ---- KPI boxes ---- */
    .print-kpi-box {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
