/* =========================================================
   app.css
   Professional RTL base stylesheet for Django shop project
   Fully Cleaned, Merged & Synchronized for Light / Dark Modes
   ========================================================= */

@import url("https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap");

/* ---------------------------------------------------------
   1. CSS Variables / Design Tokens (Dark Theme Default)
   --------------------------------------------------------- */
:root {
    --app-bg: #0b1120;
    --app-surface: #131d33;
    --app-surface-2: #1a2642;
    --app-border: #24324f;
    --app-border-soft: rgba(148, 163, 184, 0.22);
    --app-text: #f8fafc;
    --app-text-muted: #94a3b8;
    --app-heading: #ffffff;
    --app-primary: #3b82f6;
    --app-primary-hover: #2563eb;
    --app-primary-soft: rgba(59, 130, 246, 0.18);
    --app-success: #22c55e;
    --app-danger: #ef4444;
    --app-warning: #f59e0b;
    --app-info: #38bdf8;
    --app-price: #38bdf8;
    --app-price-old: #94a3b8;
    --app-radius-sm: 10px;
    --app-radius-md: 16px;
    --app-radius-lg: 20px;
    --app-radius-xl: 28px;
    --app-shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.28);
    --app-shadow-md: 0 12px 30px rgba(0, 0, 0, 0.35);
    --app-shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.45);
    --app-transition: 180ms ease;

    /* Semantic / Tailwind Bridge */
    --bg-page: #0b1120;
    --bg-card: #131d33;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #24324f;
    --input-bg: #1a2642;
    --input-border: #334155;

    --app-card-bg: var(--app-surface);       /* در تم تاریک رنگ کارت تیره هماهنگ می‌شود */
    --app-muted: var(--app-text-muted); 
}

/* ---------------------------------------------------------
   2. Light Theme Overrides
   --------------------------------------------------------- */
body.theme-light,
html:not(.dark) body.theme-light,
[data-theme="light"] {
    --app-bg: #f8fafc;
    --app-surface: #ffffff;
    --app-surface-2: #f1f5f9;
    --app-border: #e2e8f0;
    --app-border-soft: rgba(0, 0, 0, 0.08);
    --app-text: #0f172a;
    --app-text-muted: #475569;
    --app-heading: #0f172a;
    --app-primary-soft: rgba(59, 130, 246, 0.12);
    --app-price: #0369a1;
    --app-price-old: #64748b;
    --app-shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
    --app-shadow-md: 0 12px 30px rgba(15, 23, 42, 0.08);
    --app-shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);

    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #475569;
    --border-color: #e2e8f0;
    --input-bg: #ffffff;
    --input-border: #cbd5e1;

    --app-card-bg: #ffffff;                  /* در تم روشن پس‌زمینه سفید باقی می‌ماند */
    --app-muted: var(--app-text-muted);
}

/* ---------------------------------------------------------
   3. Base & Reset
   --------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    direction: rtl;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    direction: rtl;
    text-align: right;
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
    background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.10), transparent 25%),
                radial-gradient(circle at bottom left, rgba(34, 197, 94, 0.06), transparent 25%),
                var(--app-bg);
    color: var(--app-text);
    line-height: 1.85;
    overflow-x: hidden;
    transition: background-color 0.25s ease, color 0.25s ease;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--app-transition), opacity var(--app-transition);
}
a:hover {
    color: var(--app-primary);
}

img, svg, video, canvas {
    max-width: 100%;
    display: block;
}

button, input, select, textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

::selection {
    background: rgba(59, 130, 246, 0.35);
    color: #fff;
}

/* ---------------------------------------------------------
   4. Layout Containers & Surfaces
   --------------------------------------------------------- */
.app-container, .container {
    width: min(1180px, calc(100% - 32px));
    margin-inline: auto;
}

.app-section {
    padding: 28px 0;
}

.app-page {
    min-height: calc(100vh - 180px);
    padding: 28px 0 40px;
}

.app-surface {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-md);
    backdrop-filter: blur(8px);
}

.app-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-sm);
}

.app-card-soft {
    background: var(--app-surface-2);
    border: 1px solid var(--app-border-soft);
    border-radius: var(--app-radius-md);
}

.app-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--app-border-soft), transparent);
    border: 0;
    margin: 20px 0;
}

/* ---------------------------------------------------------
   5. Header & Navbar
   --------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-border-soft);
    backdrop-filter: blur(14px);
}

.navbar {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand, .navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--app-heading);
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    white-space: nowrap;
}
.brand:hover, .navbar-brand:hover {
    color: var(--app-primary);
}

.nav-links, .navbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a, .navbar-nav a, .nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 12px;
    color: var(--app-text-muted);
    font-weight: 600;
    transition: background-color var(--app-transition), color var(--app-transition), transform var(--app-transition);
}
.nav-links a:hover, .navbar-nav a:hover, .nav-link:hover,
.nav-links a.active, .navbar-nav a.active, .nav-link.active {
    color: var(--app-heading);
    background: var(--app-primary-soft);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--app-border);
    background: var(--app-surface-2);
    color: var(--app-text);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 10px;
}
.theme-toggle-btn:hover {
    transform: scale(1.05);
    border-color: var(--app-primary);
}

/* ---------------------------------------------------------
   6. Footer & Enamad
   --------------------------------------------------------- */
.site-footer {
    margin-top: 42px;
    padding: 24px 0 30px;
    color: var(--app-text-muted);
    border-top: 1px solid var(--app-border-soft);
    background: var(--app-surface);
}

.footer-card {
    overflow: hidden;
    border: 1px solid var(--app-border-soft);
    border-radius: 22px;
    background: radial-gradient(circle at top left, rgba(16, 185, 129, 0.09), transparent 34%), var(--app-surface-2);
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.16);
}

.footer-main-grid {
    display: grid;
    grid-template-columns: 1.45fr 1fr 1fr 0.9fr;
    gap: 30px;
    align-items: start;
    padding: 30px;
}

.footer-column {
    min-width: 0;
}

.footer-title {
    margin: 0 0 14px;
    color: var(--app-heading);
    font-size: 1rem;
    font-weight: 800;
}

.footer-description {
    max-width: 330px;
    margin: 0;
    font-size: 0.92rem;
    line-height: 2;
    color: var(--app-text-muted);
}

.footer-links {
    display: grid;
    gap: 10px;
    padding: 0;
    margin: 0;
    list-style: none;
}
.footer-links a {
    position: relative;
    display: inline-flex;
    width: fit-content;
    color: var(--app-text-muted);
    font-size: 0.92rem;
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
}
.footer-links a::before {
    content: "←";
    margin-left: 7px;
    color: #34d399;
    opacity: 0;
    transform: translateX(5px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.footer-links a:hover {
    color: var(--app-heading);
    transform: translateX(-3px);
}
.footer-links a:hover::before {
    opacity: 1;
    transform: translateX(0);
}

.footer-enamad {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.footer-enamad .footer-title {
    width: 100%;
}
.footer-enamad-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px;
    border: 1px solid var(--app-border-soft);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.footer-enamad-link:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 30px rgba(16, 185, 129, 0.18);
}
.footer-enamad-image {
    display: block;
    width: 96px;
    max-width: 100%;
    height: 96px;
    object-fit: contain;
}
.footer-enamad-text {
    margin: 10px 0 0;
    color: var(--app-text-muted);
    font-size: 0.75rem;
    line-height: 1.8;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 30px;
    border-top: 1px solid var(--app-border-soft);
    color: var(--app-text-muted);
    font-size: 0.82rem;
}

/* ---------------------------------------------------------
   7. Typography & Buttons
   --------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    color: var(--app-heading);
    line-height: 1.35;
    letter-spacing: -0.02em;
}
p {
    margin-top: 0;
    color: inherit;
}
.text-muted, .muted {
    color: var(--app-text-muted) !important;
}
.lead {
    font-size: 1.05rem;
    color: var(--app-text);
}

.btn, .app-btn, button.btn, input[type="submit"].btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-weight: 700;
    line-height: 1;
    transition: transform var(--app-transition), background-color var(--app-transition), border-color var(--app-transition), color var(--app-transition), box-shadow var(--app-transition);
    text-align: center;
    white-space: nowrap;
}
.btn:hover, .app-btn:hover, button.btn:hover, input[type="submit"].btn:hover {
    transform: translateY(-1px);
}
.btn:active, .app-btn:active {
    transform: translateY(0);
}

.btn-primary, .btn-primary:hover, .app-btn-primary {
    color: #ffffff !important;
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-hover));
    border-color: transparent;
    box-shadow: 0 10px 24px rgba(59, 130, 246, 0.24);
}
.btn-primary:hover, .app-btn-primary:hover {
    box-shadow: 0 14px 30px rgba(59, 130, 246, 0.3);
}

.btn-secondary, .app-btn-secondary {
    color: var(--app-text);
    background: var(--app-surface-2);
    border-color: var(--app-border);
}
.btn-secondary:hover, .app-btn-secondary:hover {
    color: var(--app-heading);
    background: var(--app-surface);
}

.btn-outline, .app-btn-outline {
    color: var(--app-primary);
    background: transparent;
    border-color: var(--app-primary);
}
.btn-outline:hover, .app-btn-outline:hover {
    color: #ffffff !important;
    background: var(--app-primary);
}

.btn-success, .app-btn-success {
    color: #ffffff !important;
    background: linear-gradient(135deg, #16a34a, #22c55e);
    border-color: transparent;
}
.btn-danger, .app-btn-danger {
    color: #ffffff !important;
    background: linear-gradient(135deg, #dc2626, #ef4444);
    border-color: transparent;
}
.btn-warning, .app-btn-warning {
    color: #111827 !important;
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    border-color: transparent;
}

/* ---------------------------------------------------------
   8. Forms & Inputs
   --------------------------------------------------------- */
.form-group {
    margin-bottom: 18px;
}
.form-label, label {
    display: inline-block;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--app-text);
}
.form-control,
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="url"], input[type="tel"],
input[type="search"], input[type="file"], select, textarea {
    width: 100%;
    min-height: 46px;
    padding: 11px 14px;
    color: var(--app-text);
    background: var(--app-surface-2);
    border: 1px solid var(--app-border);
    border-radius: 12px;
    outline: none;
    transition: border-color var(--app-transition), box-shadow var(--app-transition), background-color var(--app-transition);
}
textarea, textarea.form-control {
    min-height: 130px;
    resize: vertical;
}
.form-control::placeholder, input::placeholder, textarea::placeholder {
    color: var(--app-text-muted);
}
.form-control:focus, input:focus, select:focus, textarea:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 4px var(--app-primary-soft);
    background: var(--app-surface);
}
.form-text, .help-text, small.text-muted {
    color: var(--app-text-muted);
    font-size: 0.9rem;
}
input[type="checkbox"], input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--app-primary);
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.password-toggle {
    position: absolute;
    left: 12px;
    cursor: pointer;
    color: var(--app-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    z-index: 10;
    transition: color 0.2s;
}
.password-toggle:hover {
    color: var(--app-primary);
}
input[type="password"], input[data-password-field] {
    padding-left: 45px !important;
}

/* ---------------------------------------------------------
   9. Alerts, Panels & Tables
   --------------------------------------------------------- */
.messages {
    list-style: none;
    padding: 0;
    margin: 18px 0;
}
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    margin-bottom: 10px;
    border-radius: 14px;
    border: 1px solid transparent;
    font-weight: 600;
    box-shadow: var(--app-shadow-sm);
}
.alert-success {
    color: #166534;
    background: rgba(34, 197, 94, 0.16);
    border-color: rgba(34, 197, 94, 0.28);
}
body:not(.theme-light) .alert-success { color: #dcfce7; }

.alert-danger, .alert-error {
    color: #991b1b;
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.28);
}
body:not(.theme-light) .alert-danger, body:not(.theme-light) .alert-error { color: #fee2e2; }

.alert-warning {
    color: #92400e;
    background: rgba(245, 158, 11, 0.16);
    border-color: rgba(245, 158, 11, 0.28);
}
body:not(.theme-light) .alert-warning { color: #fef3c7; }

.alert-info {
    color: #075985;
    background: rgba(14, 165, 233, 0.16);
    border-color: rgba(56, 189, 248, 0.28);
}
body:not(.theme-light) .alert-info { color: #cffafe; }

.card, .panel, .app-panel {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-sm);
}
.card-header, .panel-header, .app-panel-header {
    padding: 18px 20px 0;
    color: var(--app-heading);
}
.card-body, .panel-body, .app-panel-body {
    padding: 20px;
}
.card-footer, .panel-footer, .app-panel-footer {
    padding: 0 20px 20px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
    border: 1px solid transparent;
}
.badge-primary { color: var(--app-primary); background: var(--app-primary-soft); border-color: rgba(59, 130, 246, 0.25); }
.badge-success { color: var(--app-success); background: rgba(34, 197, 94, 0.14); border-color: rgba(34, 197, 94, 0.25); }
.badge-danger { color: #ffffff !important; background: #dc2626; border-color: rgba(239, 68, 68, 0.25); }
.badge-warning { color: #92400e; background: rgba(245, 158, 11, 0.18); border-color: rgba(245, 158, 11, 0.25); }
body:not(.theme-light) .badge-warning { color: #fde68a; }
.badge-muted { color: var(--app-text-muted); background: var(--app-surface-2); border-color: var(--app-border); }

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--app-radius-lg);
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-sm);
}
.table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
}
.table th, .table td {
    padding: 14px 16px;
    text-align: right;
    border-bottom: 1px solid var(--app-border);
    vertical-align: middle;
    color: var(--app-text);
}
.table th {
    background: var(--app-surface-2);
    color: var(--app-heading);
    font-size: 0.85rem;
    font-weight: 800;
}
.table tr:hover td {
    background: var(--app-primary-soft);
}
.table tr:last-child td {
    border-bottom: 0;
}

/* ---------------------------------------------------------
   10. Product & Store Cards (Adaptive for Themes)
   --------------------------------------------------------- */
.product-grid, .store-grid, .dashboard-grid {
    display: grid;
    gap: 18px;
}
.product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.store-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dashboard-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.product-card, .store-card, .stat-card, .hp-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-sm);
    transition: transform var(--app-transition), box-shadow var(--app-transition), border-color var(--app-transition);
}
.product-card:hover, .store-card:hover, .stat-card:hover, .hp-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--app-shadow-md);
    border-color: var(--app-primary);
}

.product-image, .store-image {
    aspect-ratio: 4 / 3;
    background: var(--app-surface-2);
    overflow: hidden;
}
.product-image img, .store-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-body, .store-body, .stat-card {
    padding: 18px;
}
.product-title, .store-title {
    margin: 0 0 8px;
    font-size: 1rem;
    font-weight: 800;
    color: var(--app-heading);
}
.product-price {
    margin-top: 8px;
    color: var(--app-price);
    font-size: 1.05rem;
    font-weight: 800;
}
.product-meta, .store-meta, .card-meta {
    color: var(--app-text-muted);
    font-size: 0.92rem;
}
.product-actions, .actions, .card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

/* Dashboard Stats */
.stat-card .label {
    display: block;
    margin-bottom: 8px;
    color: var(--app-text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}
.stat-card .value {
    font-size: 1.7rem;
    font-weight: 900;
    color: var(--app-heading);
}

/* Image Frames */
.product-image-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 1rem;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
}
.product-image-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.product-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--app-text-muted);
    background: var(--app-surface-2);
    font-size: 0.95rem;
}
.product-image-frame-lg {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 1.25rem;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
}
.product-image-frame-lg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ---------------------------------------------------------
   11. Homepage Slider & Components
   --------------------------------------------------------- */
.hp-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}
.hp-eyebrow {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--app-primary);
    background: var(--app-primary-soft);
    border: 1px solid rgba(59,130,246,0.3);
    padding: 0.25rem 0.9rem;
    border-radius: 999px;
    margin-bottom: 0.6rem;
}
.hp-title {
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 800;
    color: var(--app-heading);
}
.hp-search input {
    background: var(--app-surface-2);
    border: 1px solid var(--app-border);
    color: var(--app-text);
    border-radius: 999px;
    padding: 0.65rem 2.6rem 0.65rem 1rem;
    width: 240px;
}
.hp-sort {
    appearance: none;
    background: var(--app-surface-2);
    border: 1px solid var(--app-border);
    color: var(--app-text);
    border-radius: 999px;
    padding: 0.65rem 2.4rem 0.65rem 1.2rem;
}
.hp-slider {
    display: flex;
    align-items: stretch;
    gap: 0.9rem;
}
.hp-viewport {
    flex: 1;
    overflow: hidden;
    min-height: 380px;
}
.hp-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.1rem;
}
.hp-figure {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    margin: 0;
    background: var(--app-surface-2);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hp-figure img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.hp-free-shipping {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: #ffffff !important;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 6px;
    z-index: 3;
}
.hp-body {
    padding: 0.9rem 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.hp-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--app-heading);
}
.hp-store {
    font-size: 0.75rem;
    color: var(--app-text-muted);
}
.hp-price-row {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
}
.hp-new {
    font-size: 1rem;
    font-weight: 800;
    color: var(--app-price);
}
.hp-arrow {
    align-self: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    background: var(--app-surface-2);
    border: 1px solid var(--app-border);
    color: var(--app-text);
}

/* ---------------------------------------------------------
   12. Orders & Notification Badges
   --------------------------------------------------------- */
.order-card {
    background-color: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 1rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.order-badge-paid {
    background-color: rgba(59, 130, 246, 0.15);
    color: var(--app-primary);
    border: 1px solid rgba(59, 130, 246, 0.3);
}
.order-badge-delivered {
    background-color: rgba(34, 197, 94, 0.15);
    color: var(--app-success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}
.btn-confirm-receipt {
    background: linear-gradient(135deg, #059669, #10b981);
    color: #ffffff !important;
    padding: 0.6rem 1.2rem;
    border-radius: 0.75rem;
    border: none;
}

.notification-bell-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    color: var(--app-text);
    box-shadow: var(--app-shadow-sm);
    transition: transform var(--app-transition), background-color var(--app-transition), border-color var(--app-transition);
}
.notification-bell-btn:hover {
    transform: translateY(-1px);
    border-color: var(--app-primary);
    background: var(--app-surface-2);
}
.notification-bell-active {
    position: relative;
}
.notification-bell-active::after {
    content: "";
    position: absolute;
    top: 7px;
    inset-inline-end: 7px;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--app-danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}

/* ---------------------------------------------------------
   13. Auth, Cart & Checkout
   --------------------------------------------------------- */
.auth-wrapper {
    max-width: 520px;
    margin: 0 auto;
}
.auth-card {
    padding: 26px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-xl);
    box-shadow: var(--app-shadow-md);
}
.auth-title {
    margin-bottom: 8px;
    font-size: 1.8rem;
    font-weight: 900;
    text-align: center;
    color: var(--app-heading);
}
.auth-subtitle {
    text-align: center;
    color: var(--app-text-muted);
    margin-bottom: 22px;
}

.summary-box, .cart-box, .checkout-box, .payment-box {
    padding: 20px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-sm);
}
.summary-row, .cart-row, .checkout-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--app-border-soft);
    color: var(--app-text);
}
.summary-row:last-child, .cart-row:last-child, .checkout-row:last-child {
    border-bottom: 0;
}
.total-row {
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--app-heading);
}

.empty-state {
    padding: 34px 20px;
    text-align: center;
    background: var(--app-surface);
    border: 1px dashed var(--app-border);
    border-radius: var(--app-radius-lg);
    color: var(--app-text-muted);
}
.empty-state h3 {
    margin-bottom: 8px;
    color: var(--app-heading);
}

/* ---------------------------------------------------------
   14. Helper Utilities & Direction
   --------------------------------------------------------- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.w-100 { width: 100%; }

.mt-0 { margin-top: 0; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 20px; }
.py-1 { padding-top: 4px; padding-bottom: 4px; } .py-2 { padding-top: 8px; padding-bottom: 8px; } .py-3 { padding-top: 12px; padding-bottom: 12px; } .py-4 { padding-top: 16px; padding-bottom: 16px; } .py-5 { padding-top: 20px; padding-bottom: 20px; }
.px-1 { padding-inline: 4px; } .px-2 { padding-inline: 8px; } .px-3 { padding-inline: 12px; } .px-4 { padding-inline: 16px; } .px-5 { padding-inline: 20px; }
.rounded-sm { border-radius: 10px; } .rounded-md { border-radius: 16px; } .rounded-lg { border-radius: 20px; } .rounded-xl { border-radius: 28px; }

[dir="rtl"] .ms-auto { margin-inline-start: auto !important; margin-inline-end: 0 !important; }
[dir="rtl"] .me-auto { margin-inline-end: auto !important; margin-inline-start: 0 !important; }

/* ---------------------------------------------------------
   15. Media Queries & Responsiveness
   --------------------------------------------------------- */
@media (max-width: 1200px) {
    .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dashboard-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 992px) {
    .product-grid, .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .store-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .navbar { flex-wrap: wrap; }
}

@media (max-width: 900px) {
    .footer-main-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
    .footer-enamad { align-items: flex-start; text-align: right; }
    .footer-enamad .footer-title { text-align: right; }
}

@media (max-width: 768px) {
    .app-container, .container { width: min(100% - 24px, 1180px); }
    .nav-links, .navbar-nav { width: 100%; overflow-x: auto; padding-bottom: 4px; }
    .product-grid, .dashboard-grid, .store-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 20px; }
    .site-header { position: static; }
}

@media (max-width: 560px) {
    .footer-main-grid { grid-template-columns: 1fr; gap: 26px; padding: 24px 20px; }
    .footer-description { max-width: none; }
    .footer-enamad { align-items: center; text-align: center; padding-top: 20px; border-top: 1px solid var(--app-border-soft); }
    .footer-enamad .footer-title { text-align: center; }
    .footer-bottom { flex-direction: column; padding: 15px 20px; text-align: center; line-height: 1.9; }
}

@media (max-width: 480px) {
    .btn, .app-btn { width: 100%; }
    .product-actions, .actions, .card-actions, .navbar-actions { flex-direction: column; align-items: stretch; }
    .summary-row, .cart-row, .checkout-row { flex-direction: column; align-items: flex-start; }
}

/* =========================================================
   theme.css
   Modern, High-Contrast Light & Dark Theme Controller
   Enhances legibility, component styles & form fields
   ========================================================= */

/* =========================================================
   1. DARK THEME SPECIFIC REFINEMENTS
   ========================================================= */
body:not(.theme-light),
html.dark body,
[data-theme="dark"] body {
    color-scheme: dark;
}

/* Dark mode inputs & dropdowns */
body:not(.theme-light) input,
body:not(.theme-light) select,
body:not(.theme-light) textarea {
    background-color: #1a2642 !important;
    border-color: #2e3e63 !important;
    color: #f8fafc !important;
}

body:not(.theme-light) input::placeholder,
body:not(.theme-light) textarea::placeholder {
    color: #94a3b8 !important;
}

/* Product & Store Cards in Dark Mode */
body:not(.theme-light) .product-card,
body:not(.theme-light) .store-card,
body:not(.theme-light) .stat-card,
body:not(.theme-light) .hp-card {
    background-color: #131d33 !important;
    border-color: #24324f !important;
    color: #f8fafc !important;
}

body:not(.theme-light) .product-title,
body:not(.theme-light) .store-title,
body:not(.theme-light) .hp-name,
body:not(.theme-light) .stat-card .value {
    color: #ffffff !important;
}

body:not(.theme-light) .product-meta,
body:not(.theme-light) .store-meta,
body:not(.theme-light) .hp-store,
body:not(.theme-light) .stat-card .label {
    color: #94a3b8 !important;
}

body:not(.theme-light) .product-price,
body:not(.theme-light) .hp-new {
    color: #38bdf8 !important;
}

/* =========================================================
   2. LIGHT THEME SPECIFIC REFINEMENTS
   ========================================================= */
body.theme-light,
html:not(.dark) body.theme-light,
[data-theme="light"] body {
    color-scheme: light;
}

/* High contrast cards for Light Mode */
body.theme-light .product-card,
body.theme-light .store-card,
body.theme-light .stat-card,
body.theme-light .hp-card {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}

body.theme-light .product-title,
body.theme-light .store-title,
body.theme-light .hp-name,
body.theme-light .stat-card .value {
    color: #0f172a !important;
}

body.theme-light .product-meta,
body.theme-light .store-meta,
body.theme-light .hp-store,
body.theme-light .stat-card .label {
    color: #475569 !important;
}

body.theme-light .product-price,
body.theme-light .hp-new {
    color: #0284c7 !important;
}

/* Form elements in Light Mode */
body.theme-light input,
body.theme-light select,
body.theme-light textarea {
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

body.theme-light input:focus,
body.theme-light select:focus,
body.theme-light textarea:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
}

/* High Contrast Vendor Action Buttons in Light Mode */
body.theme-light .btn-secondary,
body.theme-light .app-btn-secondary {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
    color: #1e293b;
}

body.theme-light .btn-secondary:hover,
body.theme-light .app-btn-secondary:hover {
    background-color: #e2e8f0;
    color: #0f172a;
}

/* اصلاح وضوح و کنتراست نشان تخفیف در پنل فروشنده */
.text-red-400 {
    color: #dc2626 !important; /* قرمز شفاف و خوانا */
}
.bg-red-500\/15 {
    background-color: rgba(220, 38, 38, 0.12) !important;
}

/* اصلاح وضوح دکمه حذف در پنل فروشنده */
.text-rose-400 {
    color: #dc2626 !important;
    font-weight: 700 !important;
}
.bg-rose-500\/10 {
    background-color: rgba(220, 38, 38, 0.1) !important;
    border-color: rgba(220, 38, 38, 0.3) !important;
}
.bg-rose-500\/10:hover {
    background-color: #dc2626 !important;
    color: #ffffff !important;
}

/* حالت تاریک: کمی روشن‌تر تا در دارک هم بدرخشد */
body:not(.theme-light) .text-red-400,
body:not(.theme-light) .text-rose-400 {
    color: #f87171 !important;
}

/* تثبیت ابعاد فرم جستجو و آیکون ذره‌بین در هدر */
.search-form {
    position: relative;
    width: 100%;
    max-width: 320px;
}

.search-form svg {
    width: 18px !important;
    height: 18px !important;
    max-width: 18px !important;
    max-height: 18px !important;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 14px;
    pointer-events: none;
    flex-shrink: 0;
}

/* =========================================================
   تثبیت ابعاد و موقعیت آیکون‌ها و فیلترهای اسلایدر صفحه اصلی
   ========================================================= */
.hp-filters {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ۱. استایل کانتینر جستجو و آیکون ذره‌بین */
.hp-search {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
}

.hp-search svg,
.hp-search-icon {
    position: absolute !important;
    right: 14px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 18px !important;
    height: 18px !important;
    max-width: 18px !important;
    max-height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    color: var(--app-text-muted, #94a3b8) !important;
    pointer-events: none !important;
}

.hp-search input {
    background: var(--app-surface-2) !important;
    border: 1px solid var(--app-border) !important;
    color: var(--app-text) !important;
    border-radius: 999px !important;
    padding: 0.6rem 2.6rem 0.6rem 1.2rem !important;
    width: 240px !important;
    min-height: 42px !important;
    outline: none !important;
}

/* ۲. استایل دراپ‌داون مرتب‌سازی و فلش v */
.hp-sort-wrap {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
}

.hp-sort {
    appearance: none !important;
    -webkit-appearance: none !important;
    background: var(--app-surface-2) !important;
    border: 1px solid var(--app-border) !important;
    color: var(--app-text) !important;
    border-radius: 999px !important;
    padding: 0.6rem 2.4rem 0.6rem 1.2rem !important;
    min-height: 42px !important;
    cursor: pointer !important;
    outline: none !important;
}

.hp-sort-caret {
    position: absolute !important;
    left: 14px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 16px !important;
    height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    color: var(--app-text-muted, #94a3b8) !important;
    pointer-events: none !important;
}

/* ۳. آیکون‌های فلش چپ و راست اسلایدر */
.hp-arrow svg {
    width: 20px !important;
    height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
}

/* =========================================================
   استایل اختصاصی اینپوت آپلود فایل سراسری پروژه
   ========================================================= */
.custom-file-upload-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-top: 6px;
    margin-bottom: 6px;
    direction: rtl;
}

/* مخفی کردن اینپوت خام مرورگر */
.custom-file-upload-wrapper input[type="file"] {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* دکمه فارسی «انتخاب فایل» */
.custom-file-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--app-primary, #6366f1);
    color: #ffffff !important;
    padding: 8px 18px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
    flex-shrink: 0;
}

.custom-file-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

/* وضعیت و نام فایل انتخاب شده */
.custom-file-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--app-text-muted, #94a3b8);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* حالت قبل از انتخاب: علامت ضربدر قرمز */
.custom-file-status.is-empty .file-icon {
    color: #ef4444; /* قرمز */
    font-weight: bold;
    font-size: 1.1rem;
    line-height: 1;
}

.custom-file-status.is-empty .file-text {
    color: var(--app-text-muted, #94a3b8);
}

/* حالت بعد از انتخاب: علامت تیک سبز */
.custom-file-status.is-selected .file-icon {
    color: #10b981; /* سبز */
    font-weight: bold;
    font-size: 1.1rem;
    line-height: 1;
}

.custom-file-status.is-selected .file-text {
    color: #10b981;
    font-weight: 500;
}

[data-theme="dark"] .site-views-box {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}
[data-theme="dark"] .site-views-box span {
    color: #f1f5f9 !important;
}
[data-theme="dark"] .site-views-box span:nth-child(3) {
    color: #fbbf24 !important;
}
