/* style.css (نسخه بهبود یافته با طراحی رنگی جذاب) */

/* حذف تعریف فونت محلی و استفاده از فونت CDN */
body {
    font-family: 'Vazirmatn', 'Vzir', 'Tahoma', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    direction: rtl;
    text-align: right;
    font-size: 10pt;
}

.btn-outline-green,
.btn-outline-green:visited,
.btn-outline-green:focus,
.btn-outline-green:active {
    color: #034833 !important;
    border-color: #034833 !important;
}

.btn-outline-green:hover {
    background-color: #034833 !important;
    color: #fff !important;
    border-color: #034833 !important;
}

.spann{
    font-size: 1.5rem !important;
}

/* استایل برای یکسان کردن اندازه ستون‌های جدول اول */
.school-main-card .table {
    table-layout: fixed;
}

.school-main-card .table th,
.school-main-card .table td {
    text-align: center;
    vertical-align: middle;
    word-wrap: break-word;
}

/* کانتینر اصلی صفحه برای شبیه‌سازی A4 */
.page-container {
    width: 210mm;
    min-height: 297mm;
    background-color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    font-size: 11pt;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

/* استایل کلی کارت‌ها */
.card {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* هدر کارت اطلاعات مدرسه */
.school-header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%) !important;
    color: white !important;
    padding: 16px;
}

/* هدر کارت اطلاعات موسس */
.founder-header {
    background: linear-gradient(135deg, #0f9b0f 0%, #3bb143 100%) !important;
    color: white !important;
    padding: 16px;
}

/* هدر کارت آمار */
.stats-header {
    background: linear-gradient(135deg, #00b4db 0%, #0083b0 100%) !important;
    color: white !important;
    padding: 16px;
}

/* هدر کارت نمرات */
.grades-header {
    background: linear-gradient(135deg, #f46b45 0%, #eea849 100%) !important;
    color: white !important;
    padding: 16px;
}

/* استایل برای جدول‌ها */
.table.table-bordered th,
.table.table-bordered td {
    border-width: 1px !important;
    border-color: #e0e0e0 !important;
    vertical-align: middle;
    padding: 12px 10px;
}

/* استایل‌های رنگی برای سلول‌های داده */
.school-highlight {
    background-color: #e3f2fd !important;
    color: #0d47a1;
}

.founder-highlight {
    background-color: #e8f5e9 !important;
    color: #1b5e20;
}

.stats-highlight {
    background-color: #e1f5fe !important;
    color: #01579b;
}

.grades-highlight {
    background-color: #fff3e0 !important;
    color: #e65100;
}

.address-cell {
    background-color: #e0f2f1 !important;
    color: #004d40;
}

.phone-cell {
    background-color: #e0f2f1 !important;
    color: #004d40;
}

/* استایل هدر جدول‌ها */
.table-primary {
    background: linear-gradient(135deg, #bbdefb 0%, #90caf9 100%) !important;
    color: #0d47a1;
}

.table-success {
    background: linear-gradient(135deg, #c8e6c9 0%, #a5d6a7 100%) !important;
    color: #1b5e20;
}

.table-info {
    background: linear-gradient(135deg, #b3e5fc 0%, #81d4fa 100%) !important;
    color: #01579b;
}

.table-warning {
    background: linear-gradient(135deg, #ffe0b2 0%, #ffcc80 100%) !important;
    color: #e65100;
}

/* استایل دکمه چاپ */
.btn-success {
    background: linear-gradient(135deg, #43a047 0%, #66bb6a 100%);
    border: none;
    border-radius: 6px;
    font-weight: 500;
}

.btn-success:hover {
    background: linear-gradient(135deg, #388e3c 0%, #4caf50 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* استایل نمودار */
.chart-container {
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    position: relative;
    height: 250px;
    overflow: hidden;
}

/* استایل کانواس نمودار */
#gradesChart, [id^="gradesChart-"] {
    width: 100% !important;
    height: 100% !important;
    position: relative;
}

/* استایل‌های جدید برای وضوح بهتر */
.chart-label {
    font-weight: bold;
    font-size: 13px;
}

.chart-value {
    font-weight: bold;
    font-size: 14px;
}

/* ************************************** */
/* *** Media Query برای چاپ (خروجی PDF) *** */
/* ************************************** */
@media print {
    @page {
        size: A4 portrait;
        margin: 5mm;
    }

    body {
        margin: 0;
        padding: 0;
        background: none;
        font-family: 'Vazirmatn', 'Vzir', 'Tahoma', sans-serif !important;
        font-size: 10pt !important;
    }

    .page-container {
        width: 100% !important;
        min-height: auto !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 5mm !important;
        display: block;
        position: relative !important;
        overflow: hidden !important;
    }

    /* حذف دکمه چاپ و عنوان در خروجی نهایی */
    .print-none {
        display: none !important;
    }

    /* تضمین چاپ رنگ‌ها */
    .card,
    .table,
    .table th,
    .table td,
    .card-header {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    /* از شکستن بلوک مدرسه در وسط جلوگیری می‌کنیم */
    .school-data-block {
        break-inside: avoid-page;
        page-break-inside: avoid;
        margin-bottom: 0 !important;
    }

    /* تنظیم مجدد حاشیه‌های داخلی و فاصله بین بلوک‌ها برای جا شدن در A4 */
    .card {
        border: 1px solid #ccc !important;
        margin-bottom: 30px !important;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) !important;
        position: relative !important;
        overflow: hidden !important;
    }

    .card-body {
        padding: 0 !important;
        position: relative !important;
    }

    .card-header {
        padding: 12px !important;
    }

    .table-bordered th,
    .table-bordered td {
        border-color: #ddd !important;
        border-width: 1px !important;
        padding: 10px !important;
        font-size: 10pt !important;
    }

    /* غیرفعال کردن افکت‌ها در حالت چاپ */
    .card:hover {
        transform: none !important;
    }

    /* استایل نمودار در حالت چاپ */
    .chart-container {
        background-color: white !important;
        border: 1px solid #ddd !important;
        height: 220px !important;
        position: relative !important;
        overflow: hidden !important;
        page-break-inside: avoid !important;
    }

    /* اطمینان از نمایش صحیح کانواس در چاپ */
    #gradesChart, [id^="gradesChart-"] {
        position: relative !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        height: 200px !important;
    }

    /* استایل‌های جدید برای وضوح بهتر */
    .chart-label {
        font-weight: bold;
        font-size: 12px;
    }

    .chart-value {
        font-weight: bold;
        font-size: 13px;
    }

    /* جلوگیری از برش نمودار در چاپ */
    .grades-card {
        page-break-inside: avoid !important;
        break-inside: avoid-page !important;
    }
}

/* استایل مخصوص مدارس دخترانه */
.girls-school {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%) !important;
}

.girls-school .school-header {
    background: linear-gradient(135deg, #8e24aa 0%, #ab47bc 100%) !important;
    color: white !important;
}

.girls-school .table-primary {
    background: linear-gradient(135deg, #e1bee7 0%, #ce93d8 100%) !important;
    color: #4a148c !important;
}

.girls-highlight {
    background-color: #f3e5f5 !important;
    color: #6a1b9a !important;
    border-color: #e1bee7 !important;
}

.girls-address {
    background-color: #e8d4ee !important;
    color: #4a148c !important;
    border-color: #e1bee7 !important;
}

.girls-phone {
    background-color: #e8d4ee !important;
    color: #4a148c !important;
    border-color: #d1c4e9 !important;
}

/* استایل برای حالت چاپ */
@media print {
    .girls-school {
        background: #f3e5f5 !important;
    }

    .girls-school .school-header {
        background: #8e24aa !important;
        color: white !important;
    }

    .girls-school .table-primary {
        background: #e1bee7 !important;
        color: #4a148c !important;
    }

    .girls-highlight {
        background-color: #f3e5f5 !important;
        color: #6a1b9a !important;
    }

    .girls-address,
    .girls-phone {
        background-color: #e8d4ee !important;
        color: #4a148c !important;
    }
}