/* ThaanPOS: cloth-shop details, animations, barcode labels and Urdu (RTL) adjustments.
   Loaded after app.css, which holds the base design tokens (maroon brand, gold accent). */

/* ---------- surfaces: a faint woven-cloth texture behind the app ---------- */
body {
  background-image:
    repeating-linear-gradient(45deg, rgba(126, 31, 61, .03) 0 2px, transparent 2px 10px),
    repeating-linear-gradient(-45deg, rgba(183, 121, 31, .03) 0 2px, transparent 2px 10px);
  background-attachment: fixed;
}
[data-bs-theme="dark"] body {
  background-image:
    repeating-linear-gradient(45deg, rgba(217, 88, 125, .035) 0 2px, transparent 2px 10px),
    repeating-linear-gradient(-45deg, rgba(252, 217, 160, .03) 0 2px, transparent 2px 10px);
}

/* ---------- login backdrop ---------- */
.auth-bg .weave {
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(252, 217, 160, .09) 0 1px, transparent 1px 14px),
    repeating-linear-gradient(90deg, rgba(252, 217, 160, .09) 0 1px, transparent 1px 14px);
  mask-image: linear-gradient(to bottom, #000 20%, transparent 90%);
  -webkit-mask-image: linear-gradient(to bottom, #000 20%, transparent 90%);
}
.auth-note-dark { color: #8a8fa3; }

/* ---------- thaan-roll hero animation ---------- */
.hero-art .roll-spin { transform-box: fill-box; transform-origin: center; animation: rollSpin 12s linear infinite; }
.hero-art .bands { animation: bandsRun 5.4s linear infinite; }
.hero-art .weft { animation: weftShimmer 3.2s ease-in-out infinite; }
.hero-art .tape { transform-box: fill-box; transform-origin: left center; animation: tapeIn 1.3s .35s var(--ease) both; }
@keyframes rollSpin { to { transform: rotate(360deg); } }
@keyframes bandsRun { to { transform: translateX(-180px); } }
@keyframes weftShimmer { 0%, 100% { opacity: .18; } 50% { opacity: .5; } }
@keyframes tapeIn { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- unit chips (metre / thaan / box) on the cart line ---------- */
.cart-line { animation: lineIn .32s var(--ease) both; }
@keyframes lineIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
[dir="rtl"] .cart-line { animation-name: lineInRtl; }
@keyframes lineInRtl { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
.unit-chip {
  flex: 0 0 auto; min-width: 56px; padding: 3px 10px;
  border: 1.5px solid var(--brand); border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
  font-size: .78rem; font-weight: 800; letter-spacing: .01em;
  transition: transform .15s var(--ease), background .2s, color .2s;
}
.unit-chip:hover { background: var(--brand); color: #fff; }
.unit-chip:active { transform: scale(.9); }

/* ---------- product tiles, rows and fabric swatches ---------- */
.product-tile .d { font-size: .72rem; color: var(--bs-secondary-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-tile .per { font-size: .7rem; font-weight: 600; color: var(--bs-secondary-color); }
.swatch-tile {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .9rem;
  background: linear-gradient(135deg, hsl(var(--h) 62% 54%), hsl(calc(var(--h) + 42) 70% 36%));
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .14), 0 6px 14px -6px hsl(var(--h) 60% 40% / .7);
  animation: swatchIn .45s var(--ease) both;
}
.swatch-lg { width: 64px; height: 64px; font-size: 1.2rem; border-radius: 18px; }
.thumb-lg { width: 64px; height: 64px; border-radius: 18px; }
@keyframes swatchIn { from { transform: scale(.6) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }
.list-row .swatch-tile { animation: none; }
.unit-tag {
  display: inline-block; margin: 4px 4px 0 0; padding: 1px 8px; border-radius: 999px;
  font-size: .68rem; font-weight: 700; background: var(--brand-soft); color: var(--brand);
}
.unit-tag-alt { background: rgba(183, 121, 31, .16); color: #8a5a12; }
[data-bs-theme="dark"] .unit-tag-alt { color: #fcd9a0; }
.min-w-0 { min-width: 0; }
.product-card-head { display: flex; gap: 12px; align-items: center; }
.unit-note { line-height: 1.7; }

/* ---------- form section headings & unit picker ---------- */
.form-section {
  display: flex; align-items: center; gap: 8px; margin: 14px 0 2px;
  font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--brand);
}
.form-section::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--brand-soft), transparent); }
.price-preview { background: var(--brand-soft); border-radius: 12px; padding: 8px 12px; min-height: 2.2rem; }
.unit-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.unit-opt { position: relative; cursor: pointer; }
.unit-opt input { position: absolute; opacity: 0; pointer-events: none; }
.unit-opt span {
  display: inline-block; padding: 7px 16px; border: 1.5px solid var(--bs-border-color); border-radius: 999px;
  font-weight: 700; font-size: .9rem; transition: transform .2s var(--ease), background .2s, border-color .2s;
}
.unit-opt:hover span { border-color: var(--brand); }
.unit-opt input:checked + span {
  background: var(--brand-grad); color: #fff; border-color: transparent;
  box-shadow: 0 6px 16px -6px rgba(126, 31, 61, .6); transform: scale(1.04);
}
.unit-opt input:focus-visible + span { outline: 3px solid rgba(183, 121, 31, .45); outline-offset: 2px; }

/* ---------- language toggle ---------- */
.lang-toggle { font-weight: 700; min-width: 66px; }

/* ---------- barcode labels (printed through #print-area) ---------- */
.bc-label {
  box-sizing: border-box; padding: 1mm 1.5mm; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  color: #000; background: #fff; font-family: Inter, Arial, sans-serif;
  page-break-after: always; break-after: page;
}
.bc-label:last-child { page-break-after: auto; break-after: auto; }
.bc-n { font-size: 8.5pt; font-weight: 700; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-s { font-size: 7pt; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-bar { display: block; width: 100%; height: auto; }
.bc-p { font-size: 8pt; font-weight: 700; text-align: center; white-space: nowrap; }
.bc-code { font-family: monospace; font-size: 8pt; text-align: center; }

/* ---------- Urdu (RTL) ---------- */
html.lang-ur body { line-height: 1.9; }
html.lang-ur .auth-hero h1 { line-height: 1.55; }
html.lang-ur .brand-row .name, html.lang-ur .sidebar-brand { line-height: 1.5; }
html.lang-ur .btn, html.lang-ur .nav-link, html.lang-ur .list-row .title { font-size: 1.02em; }
[dir="rtl"] .cart-line .info, [dir="rtl"] .pos-meta .btn-party { text-align: right; }
[dir="rtl"] .product-tile .p .per { margin-inline-start: 2px; }
[dir="rtl"] .unit-opt span { font-size: 1rem; }

/* ---------- reduced motion: keep the layout, drop the movement ---------- */
@media (prefers-reduced-motion: reduce) {
  .hero-art *, .auth-bg .blob, .cart-line, .swatch-tile { animation: none !important; }
}

/* ---------- POS: keep the sale column inside the screen (long names and Urdu text must wrap, not widen the page) ---------- */
.pos { grid-template-columns: minmax(0, 1fr); }
.pos-right, .pos-lines, .cart-line .info { min-width: 0; }

/* ---------- dark mode: the maroon brand is too dark for small text on a dark surface ---------- */
[data-bs-theme="dark"] .unit-chip { color: #fcd9a0; border-color: #d9587d; background: rgba(217, 88, 125, .14); }
[data-bs-theme="dark"] .unit-chip:hover { background: #d9587d; color: #17090f; }
[data-bs-theme="dark"] .unit-tag { color: #f5c2d1; }
[data-bs-theme="dark"] .unit-opt span { color: var(--bs-body-color); }
