:root {
    --chocolate-dark: #4A2C2A;
    --chocolate-medium: #7B3F00;
    --chocolate-light: #A05A2C;
    --coffee-dark: #3E2723;
    --coffee-medium: #5D4037;
    --coffee-light: #8D6E63;
    --cream: #D7CCC8;
    --light-cream: #EFEBE9;
    --beige-light: #CEAB82;
}

body {
    background: rgb(206, 171, 130) !important;
    font-family: 'Vazir', 'Segoe UI', Tahoma, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 1rem;
    line-height: 1.6;
}

/* استایل ناوبار */
.navbar {
    background: linear-gradient(135deg, var(--chocolate-dark) 0%, var(--coffee-dark) 100%) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.6rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.32rem;
    color: white !important;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-img {
    height: 35px;
    width: auto;
    border-radius: 6px;
}

.today-date {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 15px;
    font-weight: 600;
    font-size: 0.935rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* کارت‌ها */
.dashboard-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.95) 100%);
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    border: none;
    margin-bottom: 1rem;
    border: 1px solid rgba(90, 60, 40, 0.2);
}

.stat-card {
    text-align: center;
    padding: 1.2rem;
}

.stat-card i {
    font-size: 1.98rem;
    margin-bottom: 0.8rem;
    display: block;
    color: var(--chocolate-dark);
}

.stat-number {
    font-size: 1.98rem;
    font-weight: 700;
    color: var(--chocolate-dark);
    margin: 0.8rem 0;
}

.stat-card p {
    color: #6c757d;
    font-weight: 600;
    font-size: 0.935rem;
    margin: 0;
}

/* استایل‌های آکاردئون محصولات */
.accordion.products-container {
    --bs-accordion-border-color: rgba(90, 60, 40, 0.3);
    --bs-accordion-border-radius: 12px;
    --bs-accordion-inner-border-radius: 10px;
    --bs-accordion-btn-focus-border-color: var(--chocolate-medium);
    --bs-accordion-btn-focus-box-shadow: 0 0 0 0.25rem rgba(122, 63, 0, 0.25);
}

.product-accordion {
    margin-bottom: 10px;
    border-radius: 12px !important;
    overflow: hidden;
    background: white;
}

.product-accordion .accordion-button {
    background: linear-gradient(135deg, #f8f9fa 0%, var(--light-cream) 100%);
    border: none;
    padding: 1rem 1.2rem;
    font-weight: 600;
    color: var(--chocolate-dark);
    border-bottom: 1px solid rgba(90, 60, 40, 0.1);
    transition: all 0.3s ease;
}

.product-accordion .accordion-button:not(.collapsed) {
    background: linear-gradient(135deg, #e9ecef 0%, #f5f1ec 100%);
    color: var(--chocolate-dark);
    box-shadow: none;
    border-bottom: 1px solid rgba(90, 60, 40, 0.2);
}

.product-accordion .accordion-button::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%234A2C2A'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
    transform: rotate(-90deg);
    transition: transform 0.2s ease-in-out;
}

.product-accordion .accordion-button:not(.collapsed)::after {
    transform: rotate(0deg);
}

.product-header-info {
    flex: 1;
    text-align: right;
}

.product-name-display {
    font-size: 1rem;
    font-weight: 700;
    color: var(--chocolate-dark);
    display: block;
}

.product-header-details {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.85rem;
}

.product-accordion .accordion-body {
    padding: 0;
    background: white;
}

.product-accordion .accordion-body .product-card {
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, #ffffff 0%, var(--light-cream) 100%);
}

/* استایل محصولات درون آکاردئون */
.product-accordion .product-name {
    margin-bottom: 1rem;
}

.product-accordion .product-info-section {
    padding: 0;
    background: transparent;
}

.product-accordion .product-details-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.product-accordion .detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    border: 1px solid rgba(90, 60, 40, 0.1);
}

.product-accordion .detail-label {
    font-weight: 600;
    color: var(--chocolate-medium);
    font-size: 0.88rem;
}

.product-accordion .detail-value {
    font-weight: 700;
    color: #2c3e50;
    font-size: 0.99rem;
}

.product-accordion .product-actions-section {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    border: 1px solid rgba(90, 60, 40, 0.1);
}

.product-accordion .actions-section {
    padding: 0;
}

.product-accordion .action-buttons {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.product-accordion .action-buttons .btn {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.8rem;
    font-size: 0.88rem;
    white-space: nowrap;
}

/* استایل دکمه پاک کردن جستجو */
.btn-search-clear {
    background: linear-gradient(135deg, var(--chocolate-medium) 0%, var(--chocolate-dark) 100%) !important;
    border: none !important;
    border-radius: 8px !important;
    color: white !important;
    padding: 0.6rem 1.2rem !important;
    margin-left: 8px !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 50px;
    box-shadow: 0 2px 5px rgba(90, 60, 40, 0.2) !important;
    position: relative;
    overflow: hidden;
}

.btn-search-clear::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--chocolate-dark) 0%, var(--coffee-dark) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 8px;
}

.btn-search-clear:hover::before {
    opacity: 1;
}

.btn-search-clear i {
    font-size: 1.1rem;
    font-weight: bold;
    position: relative;
    z-index: 1;
}

.btn-search-clear:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(90, 60, 40, 0.3) !important;
}

.btn-search-clear:active {
    transform: translateY(0) !important;
    box-shadow: 0 1px 3px rgba(90, 60, 40, 0.2) !important;
}

/* بهبود ظاهر input جستجو */
#productSearch {
    border-radius: 8px !important;
    border: 1px solid rgba(90, 60, 40, 0.3) !important;
    padding: 0.7rem 1rem !important;
    font-family: 'Vazir', 'Segoe UI', Tahoma, sans-serif !important;
    background-color: white !important;
}

#productSearch:focus {
    border-color: var(--chocolate-medium) !important;
    box-shadow: 0 0 0 0.25rem rgba(122, 63, 0, 0.25) !important;
}

/* بهبود ظاهر select فیلتر */
#productFilter {
    border-radius: 8px !important;
    border: 1px solid rgba(90, 60, 40, 0.3) !important;
    padding: 0.7rem 1rem !important;
    font-family: 'Vazir', 'Segoe UI', Tahoma, sans-serif !important;
    background-color: white !important;
}

#productFilter:focus {
    border-color: var(--chocolate-medium) !important;
    box-shadow: 0 0 0 0.25rem rgba(122, 63, 0, 0.25) !important;
}

/* دکمه‌های شکلاتی */
.btn-chocolate {
    background: linear-gradient(135deg, var(--chocolate-medium) 0%, var(--chocolate-dark) 100%);
    border: none;
    border-radius: 8px;
    padding: 0.7rem 1.2rem;
    font-weight: 600;
    font-size: 0.935rem;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(90, 60, 40, 0.3);
}

.btn-chocolate:hover {
    background: linear-gradient(135deg, var(--chocolate-dark) 0%, var(--coffee-dark) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(90, 60, 40, 0.4);
    color: white;
}

.btn-edit, .btn-sell, .btn-delete, .btn-success, .btn-primary {
    background: linear-gradient(135deg, var(--chocolate-medium) 0%, var(--chocolate-dark) 100%);
    border: none;
    border-radius: 8px;
    padding: 0.7rem 1.2rem;
    font-weight: 600;
    font-size: 0.935rem;
    color: white;
}

.btn-edit:hover, .btn-sell:hover, .btn-delete:hover, .btn-success:hover, .btn-primary:hover {
    background: linear-gradient(135deg, var(--chocolate-dark) 0%, var(--coffee-dark) 100%);
    color: white;
}

.btn-disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
}

/* استایل هدر کارت‌ها */
.card-header {
    background: linear-gradient(135deg, var(--chocolate-medium) 0%, var(--chocolate-dark) 100%) !important;
    border-radius: 12px 12px 0 0 !important;
    border: none;
    padding: 1rem 1.2rem;
}

.card-header.bg-info, .card-header.bg-success, .card-header.bg-warning {
    background: linear-gradient(135deg, var(--chocolate-medium) 0%, var(--chocolate-dark) 100%) !important;
}

.card-header h5, .card-header h6 {
    color: white;
    font-weight: 700;
    margin: 0;
    font-size: 1.045rem;
}

/* استایل بج‌ها */
.badge {
    font-size: 0.825rem;
    padding: 0.4rem 0.7rem;
    border-radius: 8px;
    font-weight: 600;
}

.bg-light {
    background: linear-gradient(45deg, var(--cream), var(--light-cream)) !important;
    color: var(--chocolate-dark) !important;
}

/* محصولات پرفروش */
.top-product-item {
    transition: all 0.3s ease;
    border-radius: 8px;
    padding: 0.8rem 1rem;
    margin-bottom: 0.6rem;
    background: rgba(122, 63, 0, 0.1);
    border: 1px solid rgba(122, 63, 0, 0.2);
}

.top-product-name {
    color: var(--chocolate-dark) !important;
    font-weight: 700 !important;
    font-size: 0.935rem;
}

.top-product-badge {
    background: linear-gradient(135deg, var(--chocolate-medium), var(--chocolate-dark)) !important;
    color: white !important;
    font-weight: 600;
}

/* نمودار */
.chart-container {
    position: relative;
    height: 220px;
    padding: 1.2rem;
}

/* استایل جداول */
.table {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    font-size: 0.935rem;
}

.table thead th {
    background: linear-gradient(135deg, var(--chocolate-medium) 0%, var(--chocolate-dark) 100%);
    color: white;
    font-weight: 700;
    border: none;
    padding: 0.8rem 1rem;
    font-size: 0.88rem;
}

.table tbody td {
    padding: 0.7rem 1rem;
    border-color: rgba(90, 60, 40, 0.1);
    font-weight: 600;
    background: transparent !important;
}

/* استایل جدول فروش‌های امروز */
.sales-table {
    background: #F8F4F0 !important;
}

.sales-table thead th {
    background: #F8F4F0 !important;
    color: var(--chocolate-dark) !important;
    font-weight: 700;
    border: none;
    padding: 0.8rem 0.5rem;
    font-size: 0.88rem;
    border-bottom: 2px solid var(--chocolate-medium);
    text-align: center;
}

.sales-table tbody tr {
    background: transparent !important;
    transition: all 0.3s ease;
}

.sales-table tbody tr:hover {
    background: rgba(122, 63, 0, 0.05) !important;
}

.sales-table tbody td {
    background: transparent !important;
    border-color: rgba(90, 60, 40, 0.1);
    font-weight: 600;
    color: #495057;
    padding: 0.7rem 0.5rem;
    text-align: center;
    vertical-align: middle;
}

.sales-table tbody td:first-child {
    max-width: 150px !important;
    min-width: 120px;
    text-align: right;
}

.sales-table tbody td:nth-child(2),
.sales-table tbody td:nth-child(3),
.sales-table tbody td:nth-child(4) {
    max-width: 70px !important;
    min-width: 60px;
    text-align: center;
}

.sales-table .total-row {
    background: rgba(122, 63, 0, 0.08) !important;
    font-weight: 700;
    color: var(--chocolate-dark) !important;
    border-top: 2px solid var(--chocolate-medium);
}

.sales-table .total-row td {
    padding: 0.8rem 0.5rem;
    text-align: center;
}

.sales-table .total-row td:first-child {
    text-align: right;
}

.sales-table .number-cell {
    font-family: 'Vazir', 'Segoe UI', Tahoma, sans-serif;
    direction: ltr;
    display: inline-block;
}

/* استایل پیغام‌ها */
.alert-message {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 9999;
    min-width: 300px;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    border: none;
    font-size: 0.935rem;
}

/* استایل فوتر */
footer {
    margin-top: auto;
    padding: 1.2rem 0;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

footer p {
    margin: 0;
    font-weight: 600;
    color: white;
    font-size: 0.935rem;
}

/* کلاس‌های کمکی */
.out-of-stock {
    color: #dc3545 !important;
}

.low-stock {
    color: #ffc107 !important;
}

/* استایل مخصوص موبایل */
@media (max-width: 768px) {
    body {
        font-size: 0.935rem;
    }
    
    .stat-number {
        font-size: 1.65rem;
    }
    
    .product-accordion .product-details-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .product-accordion .detail-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0.7rem;
    }
    
    .navbar-content {
        display: flex;
        justify-content: space-between;
        align-items-center;
        width: 100%;
    }
    
    .today-date {
        font-size: 0.88rem;
        padding: 0.4rem 0.8rem;
    }
    
    .product-accordion .accordion-button {
        padding: 0.8rem 1rem;
    }
    
    .product-header-details {
        flex-direction: column;
        gap: 3px;
    }
    
    .product-header-details small {
        display: block;
        margin-bottom: 2px;
    }
    
    .accordion.products-container {
        --bs-accordion-btn-padding-x: 1rem;
        --bs-accordion-btn-padding-y: 0.8rem;
        --bs-accordion-body-padding-x: 1rem;
        --bs-accordion-body-padding-y: 1rem;
    }
    
    .product-accordion .action-buttons {
        flex-direction: column;
    }
    
    .product-accordion .action-buttons .btn {
        width: 100%;
    }
    
    /* استایل جستجو و فیلتر در موبایل */
    .input-group {
        flex-wrap: nowrap;
    }
    
    .btn-search-clear {
        padding: 0.5rem 0.8rem !important;
        min-width: 45px;
    }
    
    #productSearch, #productFilter {
        padding: 0.6rem 0.8rem !important;
        font-size: 0.9rem;
    }
    
    .sales-table tbody td:first-child {
        max-width: 120px !important;
        min-width: 100px;
    }
    
    .sales-table tbody td:nth-child(2),
    .sales-table tbody td:nth-child(4) {
        max-width: 50px !important;
        min-width: 40px;
    }
}

@media (max-width: 576px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .product-name-display {
        font-size: 0.99rem;
    }
    
    .product-accordion .detail-value {
        font-size: 0.88rem;
    }
    
    .logo-img {
        height: 30px;
    }
    
    /* استایل جستجو و فیلتر در موبایل کوچک */
    .btn-search-clear {
        padding: 0.4rem 0.6rem !important;
        min-width: 40px;
    }
    
    .btn-search-clear i {
        font-size: 0.9rem;
    }
    
    #productSearch, #productFilter {
        padding: 0.5rem 0.7rem !important;
        font-size: 0.85rem;
    }
}