/* Pinsara Flora — pink floral theme override on Bootstrap 5 */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=Great+Vibes&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --pf-pink: #e91e63;
  --pf-pink-dark: #c2185b;
  --pf-pink-soft: #fce4ec;
  --pf-pink-softer: #fff5f8;
  --pf-rose: #d6336c;
  --pf-gold: #d4a574;
  --pf-ink: #3a1d2a;
  --pf-muted: #8a6f7a;
  --bs-primary: var(--pf-pink);
  --bs-primary-rgb: 233, 30, 99;
  --bs-link-color: var(--pf-pink-dark);
  --bs-link-hover-color: var(--pf-rose);
  --bs-body-color: var(--pf-ink);
  --bs-body-bg: var(--pf-pink-softer);
  --bs-border-color: #f1d6e0;
}

html, body { height: 100%; }
body.app-body, body.login-wrap {
  background:
    radial-gradient(circle at 0% 0%, rgba(233, 30, 99, 0.06) 0, transparent 35%),
    radial-gradient(circle at 100% 100%, rgba(212, 165, 116, 0.07) 0, transparent 40%),
    var(--pf-pink-softer);
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Brand typography matching the shop banner.
   "PINSARA" — Cinzel (serif, all-caps, evokes the chunky serif on the banner)
   "Flora"   — Great Vibes (flowing script, matches the calligraphic accent)
   App headings — Cinzel at a lighter weight */
.brand-mark { display: inline-flex; align-items: baseline; gap: 4px; line-height: 1; }
.brand-mark .brand-serif {
  font-family: 'Cinzel', Georgia, 'Times New Roman', serif;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--pf-pink-dark);
}
.brand-mark .brand-script {
  font-family: 'Great Vibes', 'Brush Script MT', cursive;
  font-weight: 400;
  color: var(--pf-rose);
  font-size: 1.55em;
  line-height: 0.6;
  margin-left: 4px;
  transform: translateY(0.1em);
}
h1, h2, h3, .card-title {
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--pf-pink-dark);
}
h4, h5, h6 { font-weight: 600; }

/* ===== Navbar ===== */
.app-navbar {
  background: linear-gradient(135deg, #fff 0%, var(--pf-pink-soft) 100%);
  box-shadow: 0 2px 10px rgba(233, 30, 99, 0.08);
  border-bottom: 2px solid var(--pf-pink);
}
.app-navbar .brand-mark .brand-serif { font-size: 1.05rem; }
.app-navbar .brand-mark .brand-script { font-size: 1.7em; }
.app-navbar .nav-link {
  color: var(--pf-ink);
  font-weight: 500;
  border-radius: 8px;
  padding: 0.4rem 0.85rem !important;
  margin: 0 2px;
  transition: background-color 0.15s, color 0.15s;
}
.app-navbar .nav-link:hover { background: var(--pf-pink-soft); color: var(--pf-pink-dark); }
.app-navbar .nav-link.active {
  background: var(--pf-pink);
  color: #fff !important;
}
.app-navbar .dropdown-menu { border: 1px solid var(--bs-border-color); box-shadow: 0 6px 24px rgba(233,30,99,0.10); }
.app-navbar .dropdown-item:hover { background: var(--pf-pink-soft); color: var(--pf-pink-dark); }

/* ===== Mobile offcanvas (right-slide) ===== */
.app-offcanvas .offcanvas-header {
  border-bottom: 1px solid var(--bs-border-color);
  background: #fff;
}
.app-offcanvas .offcanvas-title { color: var(--pf-pink-dark); font-weight: 600; }
@media (max-width: 991.98px) {
  .app-offcanvas {
    /* Plain solid background — gradients during slide animation cause repaint jank on phones */
    background: #fff;
    width: 82vw !important;
    max-width: 340px;
    border-left: 3px solid var(--pf-pink);
    box-shadow: -8px 0 24px rgba(0,0,0,0.10);
    /* Force a compositor layer so the transform animates on GPU */
    will-change: transform;
    transition: transform 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
  }
  .app-offcanvas .nav-link {
    padding: 0.75rem 1rem !important;
    border-radius: 10px;
    margin-bottom: 4px;
    font-size: 1rem;
  }
  .app-offcanvas .dropdown-menu {
    border: none;
    background: var(--pf-pink-softer);
    margin-left: 0.75rem;
    box-shadow: none;
  }
  .app-offcanvas .navbar-nav { width: 100%; }
  /* Backdrop fades cleanly with the slide */
  .offcanvas-backdrop { transition: opacity 0.28s ease !important; }
}

/* ===== Buttons ===== */
.btn-primary {
  background: linear-gradient(135deg, var(--pf-pink) 0%, var(--pf-rose) 100%);
  border: none;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(233,30,99,0.25);
}
.btn-primary:hover, .btn-primary:focus {
  background: linear-gradient(135deg, var(--pf-pink-dark) 0%, var(--pf-rose) 100%);
  box-shadow: 0 4px 12px rgba(233,30,99,0.35);
}
.btn-outline-primary {
  color: var(--pf-pink-dark);
  border-color: var(--pf-pink);
}
.btn-outline-primary:hover {
  background: var(--pf-pink);
  border-color: var(--pf-pink);
}

/* ===== Cards ===== */
.card {
  border: 1px solid var(--bs-border-color);
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(233,30,99,0.05);
}
.card-header {
  background: linear-gradient(135deg, #fff 0%, var(--pf-pink-soft) 100%);
  border-bottom: 1px solid var(--bs-border-color);
  font-weight: 600;
  color: var(--pf-pink-dark);
}

/* ===== Tables ===== */
.table thead th {
  background: var(--pf-pink-soft);
  color: var(--pf-pink-dark);
  font-weight: 600;
  border-bottom: 2px solid var(--pf-pink);
}
.table-hover tbody tr:hover { background: var(--pf-pink-softer); }

/* Comfortable spacing — applied to every app table */
.table-comfort {
  --bs-table-bg: transparent;
  font-size: 0.95rem;
}
.table-comfort > :not(caption) > * > * {
  padding: 0.9rem 1rem;
  vertical-align: middle;
}
.table-comfort thead th {
  padding-top: 1.05rem;
  padding-bottom: 1.05rem;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.table-comfort tbody tr { border-bottom: 1px solid var(--bs-border-color); }
.table-comfort tbody tr:last-child { border-bottom: none; }

/* Stacked-card layout on mobile.
   Each <td> must have data-label="…" so the column name appears as the field label. */
@media (max-width: 767.98px) {
  .table-stack { display: block; }
  .table-stack thead { display: none; }
  .table-stack tbody, .table-stack tr { display: block; }
  .table-stack tr {
    background: #fff;
    border: 1px solid var(--bs-border-color);
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(233,30,99,0.05);
    padding: 0.5rem 0.9rem;
    margin: 0.75rem 0.6rem;
  }
  .table-stack td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border: none !important;
    padding: 0.55rem 0 !important;
    border-bottom: 1px dashed var(--bs-border-color) !important;
    text-align: right;
  }
  .table-stack td:last-child { border-bottom: none !important; padding-bottom: 0.25rem !important; }
  .table-stack td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--pf-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    flex-shrink: 0;
    margin-right: 0.5rem;
  }
  .table-stack td[data-label=""]::before, .table-stack td:not([data-label])::before { content: none; }
  .table-stack td.text-end, .table-stack td.text-center { text-align: right !important; }
  /* Row hover doesn't make sense on touch — disable it on small screens */
  .table-hover.table-stack tbody tr:hover { background: #fff; }
}

/* Comfortable cards too */
.card .card-body { padding: 1.25rem; }
.card .card-header { padding: 0.9rem 1.25rem; }
@media (min-width: 992px) {
  .card .card-body { padding: 1.5rem; }
}

/* Slightly larger default form controls for comfort */
.form-control, .form-select { padding: 0.55rem 0.85rem; }
.input-group .input-group-text { padding: 0.55rem 0.85rem; }

/* Date-range quick-pick pills (reports pages) — wrap cleanly on narrow screens */
.report-quickpicks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.report-quickpicks .btn { flex: 0 0 auto; }

/* Empty-state cells — uniform feel across all list tables */
.empty-state {
  padding: 2.5rem 1rem;
  color: var(--pf-muted);
}
.empty-state .empty-icon {
  font-size: 2.4rem;
  color: var(--pf-pink);
  opacity: 0.55;
  margin-bottom: 0.5rem;
  display: block;
}

/* POS product tile keyboard focus */
.pos-product-card:focus-visible {
  outline: 2px solid var(--pf-pink);
  outline-offset: 2px;
}

/* Improve readability of small-tile stat-value when currency is long */
.stat-tile .stat-value { word-break: keep-all; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Polish the page footer */
.app-footer {
  background: linear-gradient(180deg, transparent 0%, rgba(252, 228, 236, 0.6) 100%);
  padding-top: 1rem;
}
.app-footer .footer-brand {
  font-family: 'Cinzel', Georgia, serif;
  color: var(--pf-pink-dark);
  letter-spacing: 0.5px;
}

/* Universal print baseline for any report */
@media print {
  body { background: #fff !important; }
  .app-navbar, .app-footer, .no-print { display: none !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; }
  .stat-tile { box-shadow: none !important; border: 1px solid #ddd !important; }
  a { color: #000 !important; text-decoration: none !important; }
  .table-stack { display: table !important; }
  .table-stack thead { display: table-header-group !important; }
  .table-stack tbody, .table-stack tr { display: table-row-group !important; }
  .table-stack tr { display: table-row !important; box-shadow: none !important; border: none !important; margin: 0 !important; }
  .table-stack td { display: table-cell !important; padding: 0.4rem 0.6rem !important; border-bottom: 1px solid #eee !important; text-align: left !important; }
  .table-stack td::before { content: none !important; }
  .table-stack td.text-end { text-align: right !important; }
  .table-stack td.text-center { text-align: center !important; }
}

/* ===== Forms ===== */
.form-control:focus, .form-select:focus {
  border-color: var(--pf-pink);
  box-shadow: 0 0 0 0.2rem rgba(233, 30, 99, 0.15);
}
.form-label { font-weight: 500; color: var(--pf-ink); }

/* ===== Stat tiles ===== */
.stat-tile {
  border-radius: 14px;
  padding: 1.1rem 1.2rem;
  background: linear-gradient(135deg, #fff 0%, var(--pf-pink-soft) 100%);
  border: 1px solid var(--bs-border-color);
  box-shadow: 0 2px 8px rgba(233,30,99,0.05);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0; /* lets ellipsis work inside flex */
}
.stat-tile .stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--pf-pink);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-tile > div:last-child { min-width: 0; flex: 1; }
.stat-tile .stat-label { color: var(--pf-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-tile .stat-value { font-size: 1.6rem; font-weight: 700; color: var(--pf-ink); line-height: 1.1; }

/* Mobile: less padding, lighter shadow, single column for breathing room */
@media (max-width: 575.98px) {
  .stat-tile { padding: 0.85rem 1rem; gap: 0.75rem; }
  .stat-tile .stat-icon { width: 42px; height: 42px; font-size: 1.25rem; border-radius: 10px; }
  .stat-tile .stat-value { font-size: 1.3rem; }
  .stat-tile .stat-label { font-size: 0.72rem; }
}

/* ===== Login ===== */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(233, 30, 99, 0.15) 0, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(212, 165, 116, 0.15) 0, transparent 40%),
    linear-gradient(135deg, #fff5f8 0%, #fce4ec 100%);
  padding: 1rem;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 10px 40px rgba(233, 30, 99, 0.18);
  padding: 2.2rem 2rem;
  text-align: center;
}
.login-card img.logo { width: 140px; height: auto; margin-bottom: 0.5rem; }
.login-card .brand-mark { justify-content: center; margin-bottom: 0.25rem; }
.login-card .brand-mark .brand-serif { font-size: 1.6rem; }
.login-card .brand-mark .brand-script { font-size: 2.4rem; }
.login-card .tagline { color: var(--pf-muted); font-size: 0.9rem; margin-bottom: 1.5rem; font-style: italic; }

/* ===== Footer ===== */
.app-footer { color: var(--pf-muted); border-top: 1px solid var(--bs-border-color); margin-top: 2rem; }

/* ===== POS specific (preview) ===== */
.pos-cart-item { border-bottom: 1px dashed var(--bs-border-color); padding: 0.5rem 0; }
.pos-product-card {
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s;
}
.pos-product-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(233,30,99,0.15); }

/* ===== 80mm Thermal Receipt ===== */
@media print {
  body { background: #fff !important; }
  .no-print, .app-navbar, .app-footer { display: none !important; }
}
.receipt-80 {
  width: 72mm;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 11px;
  line-height: 1.35;
  color: #000;
  background: #fff;
  padding: 4mm 2mm;
}
.receipt-80 .center, .receipt-80 .r-center { text-align: center; }
.receipt-80 .right, .receipt-80 .r-right { text-align: right; }
.receipt-80 table { width: 100%; border-collapse: collapse; }

/* Logo — fully B&W on both screen and print for a clean thermal-receipt look */
.receipt-80 .receipt-logo {
  display: block;
  margin: 0 auto 4px;
  width: 38mm;
  height: auto;
  filter: grayscale(1) contrast(1.5) brightness(0.9);
}

/* Shop identity block — strictly black-and-white, no theme colors here */
.receipt-80 .shop-name {
  font-family: 'Cinzel', Georgia, "Times New Roman", serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-align: center;
  margin: 0;
  color: #000 !important;
}
.receipt-80, .receipt-80 * { color: #000; }
.receipt-80 .shop-tagline, .receipt-80 .inv-stamp, .receipt-80 .receipt-credit { color: #555; }
.receipt-80 .receipt-credit .brand { color: #333; }
.receipt-80 .shop-tagline {
  text-align: center;
  font-style: italic;
  font-size: 10px;
  color: #333;
  margin: 1px 0 4px;
  letter-spacing: 0.3px;
}
.receipt-80 .shop-info { text-align: center; font-size: 10px; }

/* Dividers */
.receipt-80 .div-solid { border-top: 1px solid #000; margin: 5px 0; height: 0; }
.receipt-80 .div-dash  { border-top: 1px dashed #000; margin: 5px 0; height: 0; }
.receipt-80 .div-double { border-top: 1px solid #000; border-bottom: 1px solid #000; height: 3px; margin: 6px 0; }

/* Meta rows (invoice/date/cashier) */
.receipt-80 table.meta td { padding: 1px 0; }
.receipt-80 table.meta td.label { color: #555; }
.receipt-80 table.meta td.value { text-align: right; font-weight: 600; }

/* Items section */
.receipt-80 .items-header {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 700;
  padding: 2px 0;
}
.receipt-80 .item { margin: 4px 0; }
.receipt-80 .item-name { font-weight: 600; font-size: 11px; }
.receipt-80 .item-line {
  display: flex;
  justify-content: space-between;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 10px;
  color: #222;
}
.receipt-80 .item-total { font-weight: 700; color: #000; }

/* Totals block */
.receipt-80 table.totals td { padding: 2px 0; font-family: "Consolas", "Courier New", monospace; }
.receipt-80 table.totals td.label { font-family: inherit; }
.receipt-80 table.totals tr.grand td {
  font-size: 14px;
  font-weight: 800;
  padding: 4px 0;
  border-top: 1px solid #000;
  border-bottom: 1px solid #000;
}
.receipt-80 table.totals tr.grand td.label { font-family: 'Cinzel', Georgia, serif; letter-spacing: 1.5px; }

/* Footer */
.receipt-80 .thank-you {
  text-align: center;
  font-family: 'Great Vibes', 'Brush Script MT', cursive;
  font-size: 18px;
  margin: 8px 0 2px;
  color: #000;
  line-height: 1;
}
.receipt-80 .inv-stamp {
  text-align: center;
  font-size: 9px;
  color: #666;
  letter-spacing: 1px;
  font-family: "Consolas", "Courier New", monospace;
}
.receipt-80 .receipt-credit {
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px dotted #aaa;
  text-align: center;
  font-size: 8px;
  color: #888;
  letter-spacing: 0.3px;
  line-height: 1.4;
}
.receipt-80 .receipt-credit .brand { color: #444; font-weight: 600; letter-spacing: 0.5px; }

@page { size: 80mm auto; margin: 0; }

/* ===== Responsive tweaks ===== */
@media (max-width: 576px) {
  .app-navbar .brand-mark .brand-serif { font-size: 0.9rem; }
  .app-navbar .brand-mark .brand-script { font-size: 1.4em; }
  /* Reduce body backdrop heaviness on phones so the offcanvas slides smoothly */
  body.app-body { background: var(--pf-pink-softer); }
  /* Tighter page padding on phones */
  .app-main { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
  /* Belt-and-suspenders: never let a stray wide element cause the whole page to scroll
     horizontally. Vertical scrolling still works because position:sticky cares about
     ancestor overflow above body, and body's own overflow-x doesn't break it. */
  html, body.app-body { overflow-x: hidden; max-width: 100vw; }
}

/* ===== AJAX list (PF.ajaxList) ===== */
/* While a fetch is in-flight, dim the table card and block clicks so the
   user doesn't double-fire a page change. Subtle, not a spinner overlay. */
.pf-ajax-loading {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

/* ===== Billing & Subscription Reminders ===== */
.billing-reminder-card {
  background: linear-gradient(135deg, rgba(212, 165, 116, 0.08) 0%, rgba(233, 30, 99, 0.04) 100%);
  border: 1px solid rgba(212, 165, 116, 0.35) !important;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(212, 165, 116, 0.08);
}
.billing-reminder-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--pf-gold) 0%, var(--pf-pink) 100%);
}
.billing-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--pf-gold) 0%, #e6b980 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 4px 10px rgba(212, 165, 116, 0.25);
  flex-shrink: 0;
}
.billing-title {
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 700;
  color: var(--pf-ink);
  letter-spacing: 0.5px;
}
.billing-item {
  background: #fff;
  border: 1px solid var(--bs-border-color);
  border-radius: 12px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.2s ease-in-out;
  height: 100%;
}
.billing-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(233, 30, 99, 0.04);
}
.billing-item.overdue {
  border-color: rgba(220, 53, 69, 0.25);
  background: linear-gradient(180deg, #fff 0%, rgba(220, 53, 69, 0.01) 100%);
}
.billing-item.upcoming {
  border-color: rgba(212, 165, 116, 0.3);
  background: linear-gradient(180deg, #fff 0%, rgba(212, 165, 116, 0.02) 100%);
}
.status-badge {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  letter-spacing: 0.5px;
}
.status-badge.overdue {
  background-color: #fff0f1;
  color: #dc3545;
}
.status-badge.upcoming {
  background-color: #fdf6ee;
  color: #d4a574;
}
.billing-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--pf-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}
.billing-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--pf-ink);
  margin-bottom: 0.15rem;
}
.billing-desc {
  font-size: 0.75rem;
  color: var(--pf-muted);
}
@media (max-width: 767.98px) {
  .billing-reminder-card {
    margin-left: 0.5rem;
    margin-right: 0.5rem;
  }
}

