﻿/* ======================
   عمومی و تایپوگرافی
====================== */
html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}
body {
    margin-bottom: 60px; /* برای فوتر ثابت */
}

/* دسکتاپ: فونت بزرگ‌تر */
@media (min-width: 768px) {
    html { font-size: 16px; }
}

/* موبایل کوچک: فونت و فاصله کمتر */
@media (max-width: 576px) {
    h1, h2, h3, h4, h5, h6 { font-size: 1.1rem; }
    .card-body, .p-3, .py-4 { padding: 0.75rem !important; }
    .small { font-size: 0.85rem; }
}

/* ======================
   متغیرهای رنگ سفارشی
====================== */
:root {
    --saffron-red: #c41e3a;
    --saffron-gold: #d4a017;
}

/* ======================
   کارت‌های فروش در موبایل (فروش کل، روزانه و مشابه)
====================== */
@media (max-width: 768px) {
    /* مخفی کردن ستون‌های دسکتاپ */
    .desktop-only { display: none !important; }

    /* نمایش کارت موبایل */
    .mobile-only { display: block !important; }

    .mobile-card {
        background: #fff;
        border-radius: 16px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.1);
        overflow: hidden;
        transition: all 0.3s ease;
        margin: 0.75rem 0;
    }
    .mobile-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    }
    .primary-row {
        background: linear-gradient(135deg, #fff8e1, #fff);
        border-bottom: 1px solid #eee;
        padding: 1rem;
    }
    .secondary-row {
        background: #fff;
        padding: 0.5rem 1rem 1rem;
    }
    .mobile-card .fs-4 { font-size: 1.35rem !important; }
}

/* دسکتاپ: فقط جدول معمولی + افکت هاور */
@media (min-width: 769px) {
    .mobile-only { display: none !important; }
    .desktop-only { display: table-cell !important; }
    .table-row-hover:hover {
        background-color: #fff8e1 !important;
        transition: background-color 0.2s ease;
    }
}

/* ======================
   جداول خاص (اگر هنوز استفاده می‌کنید)
====================== */
/* #purchaseTable - خریدها */
@media (max-width: 768px) {
    #purchaseTable thead { display: none; }
    #purchaseTable tr {
        display: block;
        background: #fafafa;
        border: 1px solid #ddd;
        border-radius: 10px;
        margin-bottom: 12px;
        padding: 12px;
    }
    #purchaseTable td {
        display: flex;
        justify-content: space-between;
        padding: 6px 0;
        border: none !important;
    }
    #purchaseTable td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #555;
        font-size: 0.9rem;
    }
}

/* #stockTable - موجودی */
@media (max-width: 768px) {
    #stockTable thead { display: none; }
    #stockTable tr {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        background: #fafafa;
        border: 1px solid #ddd;
        border-radius: 10px;
        padding: 10px;
        margin-bottom: 10px;
    }
    #stockTable td {
        flex: 1 1 45%;
        display: flex;
        flex-direction: column;
        font-size: 0.9rem;
    }
    #stockTable td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.8rem;
        color: #666;
        margin-bottom: 4px;
    }
}

/* #giveTable - تحویل کالا */
@media (max-width: 767px) {
    #giveTable thead { display: none; }
    #giveTable tbody tr {
        display: block;
        margin-bottom: 1rem;
        padding: 0.75rem;
        background: #fff;
        border: 1px solid #dee2e6;
        border-radius: 0.375rem;
    }
    #giveTable td {
        display: block;
        text-align: right !important;
        padding: 0.5rem 0;
        border-bottom: 1px dotted #dee2e6;
    }
    #giveTable td::before {
        content: attr(data-label);
        display: block;
        font-weight: bold;
        margin-bottom: 0.25rem;
        color: #555;
    }
    #giveTable td:last-child { border-bottom: none; }
    #giveTable .form-control,
    #giveTable .form-select,
    #giveTable .btn { width: 100% !important; margin: 0.25rem 0; }
}

/* ======================
   فرم‌ها و Select2
====================== */
.form-control,
.form-select {
    min-height: 44px;
    font-size: 1rem;
    padding: 0.5rem 0.75rem;
}
.select2-container--default .select2-selection--single {
    height: 44px !important;
    padding: 4px 12px;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
}
.select2-selection__rendered { line-height: 34px !important; }
.select2-selection__placeholder { color: #888 !important; }

/* ======================
   دکمه‌های کوچک عمودی
====================== */
.btn-group-sm {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.btn-group-sm .btn {
    width: 100%;
    font-size: 0.9rem;
}

/* ======================
   پرینت
====================== */
@media print {
    @page { size: A4 portrait; margin: 10mm; }
    .no-print, .btn, .card-header, nav, footer, .mobile-only { display: none !important; }
    .card { border: none !important; box-shadow: none !important; }
    body { font-size: 12pt; }
    a[href]:after { content: none; }
}
