@font-face { font-family: 'Vazirmatn'; font-weight: 400; font-display: swap; src: url('../fonts/vazirmatn-400.woff2') format('woff2'); }
@font-face { font-family: 'Vazirmatn'; font-weight: 700; font-display: swap; src: url('../fonts/vazirmatn-700.woff2') format('woff2'); }
@font-face { font-family: 'Noto Kufi Arabic'; font-weight: 700; font-display: swap; src: url('../fonts/kufi-700.woff2') format('woff2'); }
@font-face { font-family: 'Noto Kufi Arabic'; font-weight: 800; font-display: swap; src: url('../fonts/kufi-800.woff2') format('woff2'); }
@font-face { font-family: 'Archivo'; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; src: url('../fonts/archivo-wdth.woff2') format('woff2'); }

:root {
  --kiln: #B3202A;
  --fired: #741319;
  --ember: #E8602C;
  --silica: #5B7083;
  --porcelain: #EDF1F4;
  --ink: #1F262D;
  --line: #D3DBE2;
  --white: #fff;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--porcelain); color: var(--ink);
  font: 400 16px/1.8 'Vazirmatn', Tahoma, sans-serif;
}
a { color: var(--kiln); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: 'Noto Kufi Arabic', 'Vazirmatn', sans-serif; font-weight: 800; line-height: 1.5; margin: 0 0 .6em; }
h1 { font-size: 2rem; } h2 { font-size: 1.4rem; } h3 { font-size: 1.1rem; font-weight: 700; }
.latin { font-family: 'Archivo', sans-serif; font-stretch: 125%; font-weight: 600; letter-spacing: .28em; text-transform: uppercase; }
.ltr { direction: ltr; unicode-bidi: embed; display: inline-block; }
.muted { color: var(--silica); }
.small { font-size: .85rem; }

/* Layout */
.container { width: min(1240px, 100% - 2rem); margin-inline: auto; }
.site-header { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.site-header .container { display: flex; align-items: center; gap: 1.5rem; min-height: 68px; }
.nav { display: flex; gap: 1.25rem; flex: 1; flex-wrap: wrap; }
.nav a { color: var(--ink); font-weight: 700; padding: .3rem 0; border-bottom: 2px solid transparent; }
.nav a.active, .nav a:hover { border-color: var(--kiln); text-decoration: none; }
.header-tools { display: flex; align-items: center; gap: 1rem; }
.cart-link { position: relative; font-weight: 700; color: var(--ink); }
.badge { background: var(--kiln); color: #fff; border-radius: 99px; font-size: .75rem; padding: 0 .5rem; min-width: 1.4rem; display: inline-block; text-align: center; margin-inline-start: .3rem; }
main { padding: 2rem 0 4rem; min-height: 70vh; }
.site-footer { background: var(--ink); color: #b9c4cd; padding: 2rem 0; font-size: .9rem; }
.site-footer .container { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; }

/* Wordmark */
.brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: 'Noto Kufi Arabic', sans-serif; font-weight: 800; font-size: 1.5rem; }
.brand-latin { font-family: 'Archivo', sans-serif; font-stretch: 125%; font-weight: 600; font-size: .5rem; letter-spacing: .4em; color: var(--silica); margin-top: .3rem; }
.brand.inverse { color: var(--porcelain); }

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 0; cursor: pointer; font: 700 .95rem 'Vazirmatn', sans-serif; padding: .6rem 1.2rem; border-radius: 8px; background: var(--kiln); color: #fff; transition: background .15s; }
.btn:hover { background: var(--fired); text-decoration: none; }
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.secondary:hover { background: var(--white); }
.btn.danger { background: transparent; color: var(--kiln); border: 1px solid var(--kiln); }
.btn.small { padding: .25rem .7rem; font-size: .8rem; }
.btn.block { width: 100%; }
label { display: block; font-weight: 700; margin-bottom: .3rem; font-size: .9rem; }
input[type=text], input[type=number], input[type=tel], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; font: inherit; padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--silica); outline-offset: 1px; }
.field { margin-bottom: 1rem; }
.error-text { color: var(--kiln); font-size: .88rem; margin-top: .3rem; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; cursor: pointer; margin: 0; }
.check input { accent-color: var(--kiln); width: 1.05rem; height: 1.05rem; }

.alert { padding: .8rem 1rem; border-radius: 8px; margin-bottom: 1.2rem; border-inline-start: 4px solid var(--silica); background: var(--white); }
.alert.success { border-color: #2e7d4f; }
.alert.error { border-color: var(--kiln); }

/* Cards, tables */
.card { background: var(--white); border-radius: var(--radius); padding: 1.4rem; border: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow: hidden; }
th, td { padding: .7rem .9rem; text-align: right; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .85rem; color: var(--silica); background: #f6f8fa; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.num { text-align: left; white-space: nowrap; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.page-head h1, .page-head h2 { margin: 0; }
.chip { display: inline-block; font-size: .75rem; padding: 0 .6rem; border-radius: 99px; background: #e2e8ee; color: var(--silica); font-weight: 700; }
.chip.red { background: #f6d9db; color: var(--fired); }
.chip.orange { background: #fbe0d2; color: #a8431a; }
.chip.green { background: #d9eede; color: #1f6b3a; }

/* Catalog */
.filter-tree { display: grid; gap: .5rem; margin-bottom: 1.2rem; }
.tree-group { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .7rem; background: #fafbfc; }
.tree-parent { font-weight: 700; }
.tree-parent .count { color: var(--silica); font-size: .8rem; font-weight: 400; margin-inline-start: auto; }
.tree-children { margin: .4rem .55rem .1rem 0; padding-right: .8rem; border-right: 2px solid var(--line); display: grid; gap: .25rem; }
.tree-child { font-size: .9rem; color: #3d4852; }

.catalog { display: grid; grid-template-columns: 260px 1fr; gap: 1.5rem; align-items: start; }
.filters { position: sticky; top: 88px; }
.filters h3 { margin-bottom: .5rem; }
.filter-group { margin-bottom: 1.2rem; display: grid; gap: .35rem; }
.filter-group .count { color: var(--silica); font-size: .8rem; margin-inline-start: auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.product { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.product-art { height: 110px; background: var(--porcelain) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='42'%3E%3Cpath d='M0 42L24 0l24 42M0 0h48M0 42h48' fill='none' stroke='%23d3dbe2' stroke-width='1'/%3E%3C/svg%3E"); display: grid; place-items: center; }
.product-body { padding: .9rem 1rem 1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.product-name { font-weight: 700; line-height: 1.6; }
.product-meta { font-size: .8rem; color: var(--silica); display: flex; flex-wrap: wrap; gap: .2rem .8rem; }
.price { font-size: 1.1rem; font-weight: 700; color: var(--kiln); margin-top: auto; padding-top: .4rem; }
.buy { display: flex; gap: .5rem; margin-top: .4rem; }
.buy input { width: 4.5rem; text-align: center; padding: .4rem; }
.buy .btn { flex: 1; padding: .4rem .6rem; }
.chips { display: flex; gap: .3rem; flex-wrap: wrap; }

.pagination { display: flex; gap: .3rem; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 2.2rem; text-align: center; padding: .3rem .6rem; border-radius: 6px; background: var(--white); border: 1px solid var(--line); color: var(--ink); }
.pagination .current { background: var(--kiln); color: #fff; border-color: var(--kiln); }
.pagination .disabled { color: var(--silica); opacity: .5; }

/* Cart */
.cart-layout { display: grid; grid-template-columns: 1fr 360px; gap: 1.5rem; align-items: start; }
.summary-row { display: flex; justify-content: space-between; padding: .45rem 0; gap: 1rem; }
.summary-row.total { border-top: 1px solid var(--line); margin-top: .4rem; padding-top: .8rem; font-weight: 700; font-size: 1.15rem; }
.gift-box { background: #fff7f1; border: 1px dashed var(--ember); border-radius: var(--radius); padding: 1rem; margin-top: 1.2rem; }
.qty-form { display: inline-flex; gap: .3rem; }
.qty-form input { width: 4.2rem; padding: .3rem; text-align: center; }
.radio-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.radio-pair label { border: 1px solid var(--line); border-radius: 8px; padding: .5rem; text-align: center; cursor: pointer; margin: 0; font-weight: 700; background: var(--white); }
.radio-pair input { display: none; }
.radio-pair input:checked + span { color: var(--kiln); }
.radio-pair label:has(input:checked) { border-color: var(--kiln); background: #fdf1f2; }

/* Home / login */
.hero { position: relative; min-height: 100vh; display: grid; place-items: center; background: var(--ink); overflow: hidden; padding: 1.5rem; }
.hero video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::before { content: ''; position: absolute; inset: 0; z-index: 1; background: linear-gradient(160deg, rgba(31,38,45,.78), rgba(116,19,25,.55)); }
.hero.no-video { background: var(--fired) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='62'%3E%3Cpath d='M0 62L36 0l36 62M0 0h72M0 62h72' fill='none' stroke='%23ffffff' stroke-opacity='.14' stroke-width='1'/%3E%3C/svg%3E"); }
.login-card { position: relative; z-index: 2; width: min(420px, 100%); background: rgba(237,241,244,.96); border-radius: 14px; padding: 2.2rem 2rem; box-shadow: 0 30px 80px rgba(0,0,0,.35); text-align: center; }
.login-card .brand { margin-bottom: 1.2rem; }
.login-card .tagline { color: var(--silica); margin: 0 0 1.5rem; }
.login-card form { text-align: right; }
.code-input { text-align: center; letter-spacing: .6em; font-size: 1.4rem; direction: ltr; }
.test-code { background: #fff7f1; border: 1px dashed var(--ember); border-radius: 8px; padding: .6rem; margin-bottom: 1rem; font-size: .9rem; text-align: center; }
.test-code strong { font-family: 'Archivo', sans-serif; font-size: 1.4rem; letter-spacing: .3em; color: var(--kiln); display: block; }
.link-btn { background: none; border: 0; color: var(--silica); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }

.quote { border-inline-start: 4px solid var(--kiln); padding-inline-start: 1rem; font-family: 'Noto Kufi Arabic', sans-serif; font-weight: 700; font-size: 1.3rem; line-height: 2; margin: 1.5rem 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.admin-nav { display: flex; gap: .5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.admin-nav a { padding: .35rem 1rem; border-radius: 99px; background: var(--white); border: 1px solid var(--line); color: var(--ink); font-weight: 700; }
.admin-nav a.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat b { display: block; font-size: 2rem; font-family: 'Noto Kufi Arabic', sans-serif; color: var(--kiln); }
.empty { text-align: center; padding: 3rem 1rem; color: var(--silica); }

@media (max-width: 900px) {
  .catalog, .cart-layout, .two-col { grid-template-columns: 1fr; }
  .filters { position: static; }
  .site-header .container { flex-wrap: wrap; padding-block: .6rem; }
}
