/* public.css - استایل‌های ماشین حساب سازماند */

/* --- تنظیمات کلی و فونت --- */
.spc-wrap {
    direction: rtl;
    font-family: 'Vazir', Tahoma, Arial, sans-serif !important;
    font-size: 12px;
    max-width: 650px; 
    margin: 20px auto;
    padding: 15px;
    border: 2px solid #007bff; /* باکس کلی آبی رنگ */
    border-radius: 10px;
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* --- تنظیمات تیترها و باکس‌های داخلی --- */
.spc-wrap h1, 
.spc-wrap h3,
.spc-wrap h4 {
    font-family: 'Vazir', Tahoma, Arial, sans-serif !important;
    font-size: 14px !important;
    font-weight: bold;
    color: #004d99;
    padding-bottom: 5px;
    margin-top: 15px;
    border-bottom: 1px solid #e0e0e0;
}

/* استایل دهی به هر بخش به عنوان یک باکس رنگی مجزا */
#sazmand-payroll-form > h3 {
    background-color: #e3f2fd; /* رنگ آبی بسیار روشن */
    color: #0d47a1;
    padding: 10px 15px;
    margin: 20px -15px 15px -15px;
    border-radius: 8px 8px 0 0;
    font-size: 14px;
}
#spc_result h3 {
    /* این تیتر در HTML جدید حذف شده و با h2 در هدر فیش جایگزین شده است */
    background-color: #e8f5e9; 
    color: #1b5e20;
    padding: 10px 15px;
    margin: 20px -15px 15px -15px;
    border-radius: 8px 8px 0 0;
    font-size: 14px;
}

/* --- استایل فرم و فیلدها --- */
.spc-wrap p {
    display: flex; 
    align-items: center; 
    margin-bottom: 8px;
    line-height: 1.6;
}
.spc-wrap label {
    display: flex;
    align-items: center;
    width: 100%;
}

.spc-wrap input[type="text"],
.spc-wrap input[type="number"],
.spc-wrap input[type="tel"],
.spc-wrap input[type="email"],
.spc-wrap select {
    flex-grow: 1; 
    padding: 6px;
    margin-right: 15px; 
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 12px;
    box-sizing: border-box; 
    max-width: 55%;
    /* مهم برای نمایش جداکننده هزارگان در فیلدهای ورودی */
    direction: ltr; 
    text-align: left;
    font-family: 'Vazir', Tahoma, Arial, sans-serif !important;
}

/* استایل رادیو باتن ها */
.spc-wrap p:has(input[type="radio"]) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}
.spc-wrap p:has(input[type="radio"]) label {
    width: auto;
    margin-left: 20px;
    font-weight: normal;
}

/* --- استایل متن توضیحات --- */
.spc-disclaimer {
    text-align: center; 
    font-size: 12px; 
    margin: 15px 0 25px 0;
    padding: 10px;
    border: 1px solid #ffcc80; /* رنگ نارنجی ملایم */
    border-radius: 6px;
    background-color: #fff3e0;
    line-height: 1.6;
    font-family: 'Vazir', Tahoma, Arial, sans-serif !important;
}

/* ==================================== */
/* --- استایل دهی بخش اطلاعات ورودی در فیش حقوقی (جدید) --- */
/* ==================================== */
#spc_payroll_header {
    background-color: #e0f7fa; /* آبی بسیار روشن */
    border: 1px solid #b2ebf2;
    padding: 10px 15px;
    margin-bottom: 15px;
    border-radius: 6px;
}

#spc_payroll_header h2 {
    font-size: 16px !important;
    color: #00838f;
    margin: 0 0 10px 0 !important;
    padding: 0 !important;
    border: none !important;
    text-align: center;
}

#spc_payroll_header p {
    justify-content: flex-start; /* Align text to the start */
    line-height: 1.8;
    margin: 3px 0;
    font-size: 13px;
}

#spc_payroll_header strong {
    min-width: 150px;
    display: inline-block;
}

#spc_payroll_header hr {
    border-top: 1px solid #b2ebf2;
    margin: 10px 0;
}


/* --- استایل جدول نتایج --- */
.spc-result-table {
    width: 100%;
    margin-top: 10px;
    border-collapse: collapse;
    font-size: 12px;
}
.spc-result-table th, .spc-result-table td {
    border: 1px solid #c5cae9; /* حاشیه جدول آبی کم‌رنگ */
    padding: 8px;
    text-align: right; /* تراز پیش‌فرض: ستون شرح */
    font-family: 'Vazir', Tahoma, Arial, sans-serif !important;
}

/* ✅ اصلاح دوم: تراز ستون مبلغ (ستون اول از چپ) به چپ (مطابق pic 1) */
.spc-result-table td:nth-child(1), .spc-result-table th:nth-child(1) {
    text-align: left;  
    direction: ltr; /* برای خوانایی بهتر اعداد */
}

.spc-result-table th {
    background-color: #bbdefb; /* پس‌زمینه تیتر جدول */
    font-weight: bold;
    color: #0d47a1;
}
.spc-result-table tr:nth-child(even) {
    background-color: #f5f5f5;
}

/* ردیف های خاص */
.spc-total-row td {
    font-weight: bold;
    background-color: #e0f2f1; /* فیروزه‌ای روشن */
    color: #004d40;
}
.spc-deduction-row td {
    color: #b71c1c; /* قرمز تیره برای کسورات */
}
.spc-net-row td {
    font-weight: bold;
    background-color: #c8e6c9; /* سبز ملایم برای خالص پرداختی */
    font-size: 1.2em;
    color: #1b5e20;
}

/* --- استایل دکمه ها --- */
.spc-submit-row {
    justify-content: space-around;
    padding: 15px 0;
}
.spc-print-row {
    text-align: center;
    padding: 15px 0 5px 0;
}

.spc-button, .spc-button-reset, .spc-button-print {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
    font-family: 'Vazir', Tahoma, Arial, sans-serif !important;
}
.spc-button {
    background-color: #007bff;
    color: white;
}
.spc-button:hover {
    background-color: #0056b3;
}
.spc-button-reset {
    background-color: #f8d7da;
    color: #721c24;
}
.spc-button-reset:hover {
    background-color: #f5c6cb;
}
/* دکمه جدید چاپ PDF */
.spc-button-print {
    background-color: #f44336; /* قرمز برای جلب توجه بیشتر */
    color: white;
    font-size: 14px;
}
.spc-button-print:hover {
    background-color: #d32f2f;
}

/* ==================================== */
/* --- استایل‌های مخصوص چاپ PDF (اصلاح نهایی و قوی‌ترین متد) --- */
/* ==================================== */
@media print {
    /* ۱. ✅ قوی‌ترین متد: ابتدا تمام عناصر را در صفحه پنهان کن */
    body * {
        visibility: hidden !important;
        overflow: hidden !important;
        display: none !important; /* ترکیب display: none و visibility: hidden برای اطمینان بیشتر */
    }

    /* ۲. ✅ فقط .spc-wrap و تمام محتویات آن را نمایش بده و روی صفحه قرار بده */
    .spc-wrap, 
    .spc-wrap * {
        visibility: visible !important;
        display: block !important;
        background-color: transparent !important; 
        color: #000 !important;
    }
    
    /* ۳. تنظیم موقعیت فیش حقوقی در بالای صفحه چاپ */
    .spc-wrap {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        margin: 0 !important;
        padding: 20px !important; 
        border: none !important;
        box-shadow: none !important;
        max-width: none !important;
        width: 100% !important;
        background-color: #fff !important;
        /* اطمینان از قرارگیری در بالاترین لایه */
        z-index: 9999 !important; 
    }
    
    /* ۴. مخفی کردن فرم، دکمه‌ها و توضیحات اضافی */
    #sazmand-payroll-form,
    .spc-submit-row,
    .spc-print-row, /* دکمه چاپ */
    .spc-disclaimer {
        display: none !important;
    }
    
    /* ۵. اصلاح استایل‌های جدول و هدر برای چاپ تمیز (تغییر رنگ به سیاه/سفید) */
    #spc_payroll_header {
        background-color: #fff !important;
        border: 1px solid #000 !important;
        padding: 8px !important;
        border-radius: 0 !important;
        margin-bottom: 10px !important;
    }
    #spc_payroll_header h2 {
        color: #000 !important;
        border-bottom: 1px solid #000 !important;
        padding-bottom: 5px !important;
    }
    #spc_payroll_header hr {
        display: none !important;
    }

    /* ۶. تنظیمات جدول برای چاپ تمیزتر */
    .spc-result-table {
        border-collapse: collapse !important;
        width: 100% !important;
        border: 1px solid #000 !important;
    }
    .spc-result-table th, .spc-result-table td {
        border: 1px solid #000 !important;
        padding: 7px !important;
        background-color: #fff !important;
        color: #000 !important;
    }
    .spc-result-table th {
        background-color: #f0f0f0 !important;
    }
    .spc-result-table tr:nth-child(even) {
        background-color: #fff !important;
    }

    /* ۷. ✅ تراز ستون مبلغ در حالت چاپ */
    .spc-result-table td:nth-child(1), .spc-result-table th:nth-child(1) {
        text-align: left !important;  
        direction: ltr !important;
    }
    
    /* ۸. استایل ردیف های برجسته برای چاپ */
    .spc-total-row td, .spc-net-row td {
        font-weight: bold !important;
        background-color: #e8e8e8 !important;
        color: #000 !important;
        font-size: 10pt !important;
    }

    /* ۹. تنظیم فونت و سایز کلی */
    body, p, table, th, td {
        font-size: 10pt !important;
        color: #000 !important;
        font-family: 'Vazir', Tahoma, Arial, sans-serif !important; 
    }
}