/* کاشی‌بازار – استایل اختصاصی RTL، بدون وابستگی به build */
@font-face { font-family: Vazirmatn; src: url('../fonts/vazirmatn-variable.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #f6f4f1; --surface: #ffffff; --surface-2: #faf8f5; --border: #e4ded6; --text: #2a2622; --muted: #6f675f;
  --primary: #8a5a3b; --primary-600: #734a30; --primary-50: #f6eee8; --accent: #2f6f6a;
  --success: #2e7d4f; --success-50: #e8f4ec; --danger: #b3261e; --danger-50: #fbeceb;
  --warning: #9a6b00; --warning-50: #fdf4dc; --info: #1f5f99; --info-50: #e7f0f9;
  --on-primary: #ffffff; --radius: 12px; --shadow: 0 1px 2px rgba(40, 30, 20, .06), 0 4px 16px rgba(40, 30, 20, .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1916; --surface: #24211d; --surface-2: #2b2823; --border: #3a352f; --text: #ece7e1; --muted: #a39a90;
    --primary: #d39a72; --primary-600: #e0ad88; --primary-50: #3a2c22; --on-primary: #1b1916; --accent: #6cc0b8;
    --success-50: #1f3326; --danger-50: #3b1f1d; --warning-50: #3a3018; --info-50: #1d2b3a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Vazirmatn, Tahoma, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); line-height: 1.8; font-size: var(--font-size, 15px); }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { line-height: 1.5; margin: 0 0 .6em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.08rem; }
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); } .small { font-size: .86rem; } .ltr { direction: ltr; unicode-bidi: embed; display: inline-block; }
.nowrap { white-space: nowrap; } .text-end { text-align: left; } .mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.stack > * + * { margin-top: 16px; } .row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; } .between { justify-content: space-between; }
.grid { display: grid; gap: 16px; } .grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } .grid-4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.sidebar-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .sidebar-layout { grid-template-columns: 1fr; } }

/* Header */
.site-header { background: var(--header-bg, var(--surface)); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.site-header .container { display: flex; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 1.2rem; color: var(--text); display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--primary), var(--accent)); display: inline-block; }
.search-box { flex: 1; min-width: 200px; }
.search-box input { width: 100%; }
.nav-links { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.nav-links a { color: var(--text); font-weight: 500; }
.badge-count { background: var(--primary); color: var(--on-primary); border-radius: 999px; padding: 0 7px; font-size: .75rem; margin-inline-start: 4px; }
.site-footer { margin-top: 48px; background: var(--footer-bg, var(--surface)); border-top: 1px solid var(--border); padding: 28px 0; color: var(--muted); font-size: .9rem; }
.site-footer a { color: var(--muted); }
main { padding: 24px 0; }

/* Cards & surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.card-title h2, .card-title h3 { margin: 0; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .value { font-size: 1.35rem; font-weight: 800; }
.stat .label { color: var(--muted); font-size: .88rem; }

/* Forms */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
input:not([type]), input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=date], input[type=datetime-local], input[type=file], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; min-height: 42px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-50); border-color: var(--primary); }
.field { margin-bottom: 14px; } .field .hint { color: var(--muted); font-size: .82rem; margin-top: 3px; }
.field-error, .error-text { color: var(--danger); font-size: .84rem; margin-top: 3px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check input { width: auto; min-height: auto; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; min-height: 42px; background: var(--primary); color: var(--on-primary); text-align: center; }
.btn:hover { background: var(--primary-600); color: var(--on-primary); }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-50); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); } .btn-danger:hover { background: #8f1d17; }
.btn-success { background: var(--success); } .btn-success:hover { background: #24653f; }
.btn-sm { padding: 4px 10px; min-height: 32px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
form.inline { display: inline; }

/* Alerts & badges */
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-success { background: var(--success-50); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert-danger { background: var(--danger-50); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-warning { background: var(--warning-50); color: var(--warning); }
.alert-info { background: var(--info-50); color: var(--info); }
.alert ul { margin: 0; padding-inline-start: 18px; }
.badge { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge-success { background: var(--success-50); color: var(--success); border-color: transparent; }
.badge-danger { background: var(--danger-50); color: var(--danger); border-color: transparent; }
.badge-warning { background: var(--warning-50); color: var(--warning); border-color: transparent; }
.badge-info { background: var(--info-50); color: var(--info); border-color: transparent; }
.badge-neutral { }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 700; white-space: nowrap; }
th a { color: var(--text); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.filters .field { margin: 0; min-width: 160px; flex: 1; }
.filters .btn { flex: 0 0 auto; }

/* Pagination (Bootstrap 5 markup) */
.pagination { display: flex; gap: 4px; list-style: none; padding: 0; margin: 16px 0 0; flex-wrap: wrap; }
.page-link { display: block; padding: 4px 11px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); background: var(--surface); }
.page-item.active .page-link { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.page-item.disabled .page-link { opacity: .5; }
nav .small.text-muted { display: none; }

/* Shop */
.hero { background: linear-gradient(120deg, var(--primary-50), var(--surface)); border: 1px solid var(--border); border-radius: 18px; padding: 32px 24px; margin-bottom: 24px; }
.hero h1 { font-size: 1.75rem; }
.product-card { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.product-card .thumb { aspect-ratio: 1 / 1; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--muted); overflow: hidden; }
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.product-card .title { font-weight: 700; color: var(--text); }
.product-card .price { font-weight: 800; margin-top: auto; }
.tile-pattern { width: 70%; height: 70%; background-image: linear-gradient(45deg, var(--border) 25%, transparent 25%), linear-gradient(-45deg, var(--border) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--border) 75%), linear-gradient(-45deg, transparent 75%, var(--border) 75%); background-size: 40px 40px; border-radius: 6px; opacity: .6; }
.filter-panel .field { margin-bottom: 10px; }
.filter-panel h3 { font-size: .95rem; margin: 12px 0 6px; }
.chip-list { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 2px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: .85rem; color: var(--text); background: var(--surface); }
.chip.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.gallery-main { aspect-ratio: 1/1; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); display: flex; align-items: center; justify-content: center; }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.spec-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.spec-list dt { color: var(--muted); } .spec-list dd { margin: 0; font-weight: 600; }
.offer-option { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.offer-option:has(input:checked) { border-color: var(--primary); background: var(--primary-50); }
.offer-option input { width: auto; min-height: auto; margin-top: 6px; }
.rounding-options { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 10px; }
.rounding-option { border: 2px solid var(--border); border-radius: 12px; padding: 12px; cursor: pointer; display: block; font-weight: 400; }
.rounding-option:has(input:checked) { border-color: var(--primary); background: var(--primary-50); }
.rounding-option.invalid { opacity: .6; cursor: not-allowed; }
.rounding-option input { width: auto; min-height: auto; }
.price-line { display: flex; justify-content: space-between; gap: 8px; }
.discount { color: var(--success); font-weight: 700; }
.strike { text-decoration: line-through; color: var(--muted); }
.timeline { list-style: none; padding: 0; margin: 0; border-inline-start: 2px solid var(--border); }
.timeline li { padding: 0 14px 12px; position: relative; }
.timeline li::before { content: ''; position: absolute; right: -7px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); }

/* Panels */
.panel-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.panel-nav { background: var(--surface); border-inline-end: 1px solid var(--border); padding: 16px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.panel-nav .brand { padding: 4px 10px 14px; }
.panel-nav a { display: block; padding: 7px 12px; border-radius: 8px; color: var(--text); font-size: .92rem; }
.panel-nav a.active, .panel-nav a:hover { background: var(--primary-50); color: var(--primary); }
.panel-nav .group { font-size: .76rem; color: var(--muted); padding: 12px 12px 4px; font-weight: 700; }
.panel-main { padding: 20px 24px 40px; min-width: 0; }
.panel-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.panel-top h1 { margin: 0; }
.nav-toggle { display: none; }
@media (max-width: 900px) {
  .panel-shell { grid-template-columns: 1fr; }
  .panel-nav { position: static; height: auto; display: none; }
  .panel-nav.open { display: block; }
  .nav-toggle { display: inline-flex; }
  .panel-main { padding: 16px; }
}
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--primary); border-color: var(--primary); }
details.box { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; background: var(--surface); }
details.box summary { cursor: pointer; font-weight: 700; }
code, pre { font-family: Consolas, monospace; direction: ltr; text-align: left; }
pre { background: var(--surface-2); padding: 10px; border-radius: 8px; overflow-x: auto; font-size: .8rem; }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); }
@media print { .site-header, .site-footer, .no-print { display: none !important; } body { background: #fff; } .card { box-shadow: none; } }

/* راهنمای پنل */
.help-toc { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.help-toc ul { list-style: none; padding: 0; margin: 10px 0 0; font-size: .88rem; }
.help-toc li { margin: 2px 0; } .help-toc li.sub { padding-inline-start: 14px; }
.help-toc input { width: 100%; }
.help-body { line-height: 2; } .help-body h2 { margin-top: 1.4em; padding-top: .4em; border-top: 1px solid var(--border); }
.help-body h2:first-child { border-top: 0; margin-top: 0; } .help-body code { background: var(--surface-2); padding: 0 4px; border-radius: 4px; }
.help-body li { margin: 4px 0; }
@media (max-width: 900px) { .help-toc { position: static; max-height: none; } }

/* ظاهر قابل تنظیم از پنل */
.announce-bar { background: var(--announce-bg, var(--accent)); color: var(--on-announce, #fff); text-align: center; padding: 6px 16px; font-size: .9rem; }
.announce-bar a { color: inherit; text-decoration: underline; }
.brand span { display: flex; flex-direction: column; line-height: 1.3; }
.brand-tagline { font-size: .72rem; font-weight: 500; color: var(--muted); }
.footer-links { display: flex; flex-direction: column; gap: 4px; }
.hero-image { background-size: cover; background-position: center; position: relative; color: #fff; min-height: 260px; }
.hero-image::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, rgba(0,0,0,.05), rgba(0,0,0,.55)); }
.hero-image > * { position: relative; } .hero-image .muted { color: rgba(255,255,255,.9); }
.hero-slider { position: relative; margin-bottom: 24px; }
.hero-slider .slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: 18px; scrollbar-width: none; }
.hero-slider .slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: start; position: relative; min-height: 300px; display: flex; align-items: flex-end;
  background: linear-gradient(120deg, var(--primary-50), var(--surface)); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; }
.slide picture, .slide picture img, .poster picture, .poster picture img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slide-body { position: relative; padding: 28px 24px; max-width: 640px; }
.slide.has-image .slide-body { color: var(--slide-text, #fff); }
.slide.has-image::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0,0,0,.55), rgba(0,0,0,0) 70%); }
.slide.has-image .slide-body { z-index: 1; }
.slider-dots { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
.slider-dots button { width: 9px; height: 9px; border-radius: 50%; border: 0; padding: 0; background: var(--border); cursor: pointer; }
.slider-dots button.active { background: var(--primary); width: 22px; border-radius: 5px; }
.poster-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.poster { position: relative; display: flex; align-items: flex-end; min-height: 180px; border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(120deg, var(--primary), var(--accent)); color: var(--slide-text, #fff); }
.poster.strip { min-height: 120px; }
.poster::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0,0,0,.5), rgba(0,0,0,0) 65%); }
.poster-body { position: relative; z-index: 1; padding: 16px; display: flex; flex-direction: column; }
.poster:hover { color: var(--slide-text, #fff); filter: brightness(1.05); }
@media (max-width: 700px) { .slide { min-height: 360px; } }
