:root {
    --font-main: 'Vazirmatn', sans-serif;
    --color-primary: #4285f4;
    --color-secondary: #34a853;
    --color-accent: #fbbc05;
    --color-danger: #ea4335;
    --bg-light: #f5f6fb;
    --bg-card: #ffffff;
    --text-main: #1f1f1f;
    --muted: #6b7280;
    --border: #e5e7eb;
}

.theme-dark {
    --bg-light: #0f172a;
    --bg-card: #111827;
    --text-main: #e5e7eb;
    --muted: #9ca3af;
    --border: #1f2937;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: var(--font-main);
    background: var(--bg-light);
    color: var(--text-main);
}

a { text-decoration: none; color: inherit; }

.container {
    max-width: 420px;
    margin: 0 auto;
    padding: 0 12px 64px;
}

.container-fluid {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px 64px;
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    overflow: visible;
}

.navbar .brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.navbar .brand img {
    height: 40px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
}

.main-menu {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.menu-item {
    position: relative;
}

.menu-link,
.menu-link-has-submenu {
    color: inherit;
    text-decoration: none;
    padding: 8px 12px;
    display: block;
    border-radius: 4px;
    transition: background 0.2s;
    cursor: pointer;
    white-space: nowrap;
}

.menu-link:hover,
.menu-link-has-submenu:hover {
    background: var(--bg-light);
}

.menu-chevron {
    font-size: 10px;
    margin-right: 4px;
}

.submenu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 0;
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none;
    z-index: 10000;
}

/* نمایش زیرمنوها هنگام hover روی منوی اصلی */
.menu-item:hover .submenu {
    display: block;
}

/* حفظ باز بودن زیرمنوها هنگام hover روی خود زیرمنو */
.menu-item .submenu:hover {
    display: block;
}

.submenu-link {
    display: block;
    padding: 8px 16px;
    color: inherit;
    text-decoration: none;
    transition: background 0.2s;
}

.submenu-link:hover {
    background: var(--bg-light);
}

@media (max-width: 768px) {
    .main-menu {
        display: none;
    }
}

.theme-toggle {
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 999px;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.stepper {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin: 16px 0;
}

.step {
    text-align: center;
    padding: 12px 8px;
    border-radius: 12px;
    border: 1px solid var(--border);
    color: var(--muted);
}

.step.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    box-shadow: 0 10px 24px rgba(66, 133, 244, 0.25);
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.05);
    margin-bottom: 12px;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
}

.list-item:hover { border-color: var(--border); }
.list-item.active { border-color: var(--color-primary); }

.badge {
    display: inline-block;
    background: var(--color-danger);
    color: #fff;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
}

.price {
    font-weight: 700;
}

.form-group {
    margin-bottom: 12px;
}
.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 14px;
}
.form-control {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 14px;
}

input, textarea, select {
    font-family: var(--font-main);
}

input::placeholder, textarea::placeholder {
    font-family: var(--font-main);
    color: var(--muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 700;
    transition: transform .1s ease, box-shadow .1s ease;
}
.btn-primary { background: linear-gradient(135deg, #4285f4, #34a853); color: #fff; }
.btn-secondary { background: linear-gradient(135deg, #4285f4, #ea4335); color: #fff; }
.btn-success { background: linear-gradient(135deg, #34a853, #4285f4); color: #fff; }
.btn-danger { background: linear-gradient(135deg, #ea4335, #fbbc05); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--border); }
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.grid {
    display: grid;
    gap: 10px;
}

.grid-products {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card-tile {
    border: 2px solid transparent;
    border-radius: 16px;
    background: var(--bg-card);
    box-shadow: 0 10px 24px rgba(0,0,0,0.08);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    cursor: pointer;
}
.card-tile:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0,0,0,0.12); border-color: var(--border); }
.card-tile.active { border-color: var(--color-primary); }
.card-tile img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 12px 12px 0 0; }
.card-tile-body { padding: 12px; text-align: center; }
.card-tile-body .fa-title { font-weight: 700; margin-bottom: 6px; }
.card-tile-body .en-title { color: var(--muted); font-size: 14px; }

@media (max-width: 640px) {
    .container-fluid { padding: 0 10px 48px; }
    .grid-products { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
}

.footer {
    position: sticky;
    bottom: 0;
    padding: 12px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
}

.total-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-radius: 12px;
    background: #e8f0fe;
    color: #0b57d0;
}

.theme-dark .total-box {
    background: #1d2a44;
    color: #cdd9ff;
}

.note {
    background: #e0f7fa;
    color: #046c84;
    border: 1px solid #b2ebf2;
    border-radius: 12px;
    padding: 10px;
    font-size: 13px;
    line-height: 1.6;
}

.theme-dark .note {
    background: #102a43;
    border-color: #1f3b57;
    color: #cde8ff;
}

.admin-grid {
    display: grid;
    gap: 12px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.table th, .table td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
}
.table th { text-align: right; color: var(--muted); }

.status-paid { color: #0ea5e9; }
.status-pending { color: #f59e0b; }
.status-failed { color: #ef4444; }

.btn-toggle-active {
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-family: var(--font-main);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-toggle-active.active {
    background: linear-gradient(135deg, #34a853, #4285f4);
    color: #fff;
}

.btn-toggle-active.active:hover {
    background: linear-gradient(135deg, #2d8f47, #357ae8);
    box-shadow: 0 2px 8px rgba(52, 168, 83, 0.3);
}

.btn-toggle-active.inactive {
    background: linear-gradient(135deg, #ea4335, #fbbc05);
    color: #fff;
}

.btn-toggle-active.inactive:hover {
    background: linear-gradient(135deg, #d33b2c, #f0b500);
    box-shadow: 0 2px 8px rgba(234, 67, 53, 0.3);
}

.btn-toggle-active i {
    font-size: 8px;
}

/* استایل تب‌های تنظیمات */
.settings-tab {
    padding: 12px 24px;
    border: 2px solid transparent;
    background: transparent;
    color: var(--muted);
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 12px 12px 0 0;
    margin-bottom: -2px;
    position: relative;
    display: inline-block;
}

.settings-tab.active {
    color: #1f2937;
    background: #ffffff;
    border: 2px solid var(--color-primary);
    border-bottom: 2px solid #ffffff;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1;
    font-weight: 700;
}

.theme-dark .settings-tab.active {
    color: #1f2937;
    background: #ffffff;
    border: 2px solid var(--color-primary);
    border-bottom: 2px solid #ffffff;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.3);
}

.settings-tab.inactive {
    color: #9ca3af;
    background: transparent;
    border: 2px solid transparent;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.settings-tab.inactive:hover {
    color: var(--text-main);
    background: var(--bg-light);
    border-radius: 12px 12px 0 0;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.theme-dark .settings-tab.inactive {
    color: #6b7280;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.theme-dark .settings-tab.active {
    box-shadow: 0 -2px 8px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2);
}

/* Responsive برای موبایل و تبلت */
@media (max-width: 900px) {
    .table {
        display: block;
        width: 100%;
        border-collapse: collapse;
    }
    
    .table thead {
        display: none;
    }
    
    .table tbody {
        display: block;
        width: 100%;
    }
    
    .table tr {
        display: block;
        width: 100%;
        margin-bottom: 16px;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 0;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    
    .table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px;
        border-bottom: 1px solid var(--border);
        text-align: right;
        width: 100%;
    }
    
    .table td:last-child {
        border-bottom: none;
    }
    
    .table td:before {
        content: attr(data-label);
        font-weight: bold;
        color: var(--muted);
        margin-left: 12px;
        flex-shrink: 0;
        min-width: 100px;
    }
    
    /* جستجو و فیلتر در موبایل */
    .form-control {
        width: 100% !important;
        min-width: auto !important;
        margin-bottom: 8px;
    }
    
    /* دکمه‌ها در موبایل */
    .btn {
        font-size: 12px;
        padding: 6px 10px;
        white-space: nowrap;
    }
    
    /* تصاویر در موبایل - قابل اسکرول افقی */
    .table td[data-label="تصویر"] {
        display: block;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: var(--muted) transparent;
        padding: 12px 16px;
        position: relative;
    }
    
    .table td[data-label="تصویر"]::-webkit-scrollbar {
        height: 6px;
    }
    
    .table td[data-label="تصویر"]::-webkit-scrollbar-track {
        background: var(--bg-light);
        border-radius: 3px;
    }
    
    .table td[data-label="تصویر"]::-webkit-scrollbar-thumb {
        background: var(--muted);
        border-radius: 3px;
    }
    
    .table td[data-label="تصویر"]::-webkit-scrollbar-thumb:hover {
        background: var(--text-main);
    }
    
    .table td[data-label="تصویر"]:before {
        content: attr(data-label);
        display: block;
        font-weight: bold;
        color: var(--muted);
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    .table td[data-label="تصویر"] > * {
        display: inline-block;
        vertical-align: top;
        min-width: 100px;
        width: 100px;
        height: 100px;
        flex-shrink: 0;
        margin-left: 8px;
    }
    
    .table td[data-label="تصویر"] img,
    .table td[data-label="تصویر"] div {
        min-width: 100px;
        width: 100px;
        height: 100px;
    }
    
    /* عملیات در موبایل */
    .table td[data-label="عملیات"] {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .table td[data-label="عملیات"] > div {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .table td[data-label="عملیات"] .btn {
        width: 100%;
        justify-content: center;
    }
    
    .table td[data-label="وضعیت"] {
        justify-content: flex-start;
    }
    
    .table td[data-label="وضعیت"] form {
        width: 100%;
    }
    
    .table td[data-label="وضعیت"] .btn-toggle-active {
        width: 100%;
        justify-content: center;
    }
    
    /* هدرها و دکمه‌های ایجاد */
    h3, h4 {
        font-size: 18px;
    }
    
    .card > div:first-child {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 12px;
    }
    
    .card > div:first-child > div {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .card > div:first-child a {
        width: 100%;
        text-align: center;
    }
}

/* برای تبلت */
@media (min-width: 601px) and (max-width: 900px) {
    .table {
        font-size: 13px;
    }
    
    .table td {
        padding: 10px 14px;
    }
    
    .table td:before {
        min-width: 120px;
    }
    
    .form-control {
        width: calc(50% - 4px) !important;
    }
}

/* استایل انتخاب درگاه پرداخت */
.payment-method-label {
    transition: all 0.2s;
}

.payment-method-label:hover {
    border-color: var(--color-primary) !important;
}

.payment-method-label input[type="radio"]:checked + span,
.payment-method-label:has(input[type="radio"]:checked) {
    border-color: var(--color-primary);
    background: var(--bg-light);
}

.gateway-option {
    transition: all 0.2s;
}

.gateway-option:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.gateway-option:has(input[type="radio"]:checked) {
    border-color: var(--color-primary);
    background: var(--bg-light);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Responsive برای صفحه پرداخت */
@media (max-width: 768px) {
    div[style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    
    div[style*="grid-template-columns:repeat(auto-fill, minmax(80px, 1fr))"] {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

