/* =====================================================
   نظام المعاينة التفاعلية — مقياس A4 التلقائي
   ===================================================== */

/* PANEL: الحاوية الخارجية */
.tarl-report-preview-panel {
    background: #c8cdd6;
    border-radius: 8px;
    padding: 16px;
    margin-top: 20px;
    overflow: hidden;
    font-family: 'Cairo', sans-serif;
}

/* WRAPPER: يضبط الارتفاع الحقيقي بعد التصغير عبر JS */
.tarl-report-preview-wrapper {
    width: 100%;
    position: relative;
    /* height يُضبط ديناميكياً عبر JS */
}

/* PAGE: صفحة A4 بحجمها الحقيقي */
.tarl-report-preview-page {
    width: 794px;          /* A4 ثابت */
    min-height: 1122px;    /* A4 ثابت */
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    border-radius: 4px;
    padding: 32px 40px;
    color: #000;
    direction: rtl;
    text-align: right;
    margin-bottom: 24px;
}

#tarl-report-preview-scale-container {
    width: 794px;
    transform-origin: top right;
    position: absolute;
    top: 0;
    right: 0;
}

/* المحتوى الداخلي للمعاينة */
.tarl-report-preview-container {
    font-family: 'Cairo', sans-serif;
    color: #000;
    direction: rtl;
    text-align: right;
    pointer-events: none;
    user-select: none;
}

/* ===== المبيان المقارن بالـ CSS فقط ===== */
.bar-chart-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}
.bar-chart-label {
    width: 60px;
    font-weight: bold;
    color: #374151;
    text-align: left;
}
.bar-chart-bars {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.bar-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bar-track {
    flex: 1;
    height: 16px;
    background-color: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
}
.bar-fill.stage1 {
    background-color: #9ca3af;
}
.bar-fill.stage2 {
    background-color: #1a3c6e;
}
.bar-fill.stage2.decrease {
    background-color: #ef4444;
}
.bar-value {
    font-size: 11px;
    font-weight: bold;
    width: 40px;
}
.bar-value.stage1 { color: #6b7280; }
.bar-value.stage2 { color: #1a3c6e; }
.bar-value.stage2.decrease { color: #ef4444; }

/* ===== PRINT: إلغاء التصغير عند الطباعة ===== */
@media print {
    .tarl-report-preview-panel  { background: white !important; padding: 0 !important; }
    .tarl-report-preview-wrapper { height: auto !important; }
    #tarl-report-preview-scale-container {
        transform: none !important;
        position: static !important;
    }
    .tarl-report-preview-page {
        box-shadow: none !important;
        width: 794px !important;
        margin-bottom: 0 !important;
        page-break-after: always;
    }
}
