/* ================================
   Fawry Boutique — Global stylesheet
   Premium feminine RTL Arabic theme
   ================================ */

:root {
  --rose: #d6336c;
  --rose-dark: #b02a5b;
  --rose-light: #fde7ef;
  --gold: #c8a96a;
  --ink: #1a1320;
  --ink-soft: #4a3f55;
  --muted: #8a7e95;
  --line: #efe6ec;
  --bg: #fdfaf7;
  --bg-2: #fff5f8;
  --card: #ffffff;
  --shadow-sm: 0 1px 2px rgba(40, 20, 50, .04);
  --shadow: 0 8px 26px rgba(60, 30, 70, .08);
  --shadow-lg: 0 18px 60px rgba(60, 30, 70, .14);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: .25s cubic-bezier(.23,1,.32,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Tajawal", "Cairo", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 16px;
  direction: rtl;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }

h1, h2, h3, h4 { margin: 0 0 .6em; line-height: 1.3; font-weight: 700; }
h1 { font-size: clamp(2rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 2.8vw, 1.85rem); }

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.3rem; border-radius: 999px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; font-family: inherit;
  font-size: .95rem; transition: var(--transition);
  background: var(--ink); color: #fff;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: scale(0.97); }
.btn.btn-rose { background: linear-gradient(135deg, var(--rose), var(--rose-dark)); }
.btn.btn-outline { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.btn-outline:hover { border-color: var(--rose); color: var(--rose); }
.btn.btn-whatsapp {
  background: #25D366; color: #fff; padding: .8rem 1.5rem;
}
.btn.btn-whatsapp:hover { background: #1ebe57; }
.btn.btn-facebook {
  background: #1877F2; color: #fff; padding: .8rem 1.5rem;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn.btn-facebook:hover { background: #0d65d9; }
.btn.btn-ghost { background: transparent; color: var(--ink); }
.btn.btn-danger { background: #dc2626; color: #fff; }
.btn.btn-sm { padding: .4rem .9rem; font-size: .85rem; }
.btn.btn-block { width: 100%; justify-content: center; }

/* ====== HEADER ====== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; gap: 20px;
}
.brand { display: flex; align-items: center; gap: .7rem; font-weight: 800; font-size: 1.2rem; color: var(--ink); }
.brand .logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--rose), var(--gold));
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.1rem;
  box-shadow: var(--shadow-sm);
}
.brand .brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand .brand-text small { color: var(--muted); font-size: .72rem; font-weight: 500; letter-spacing: .04em; }

.main-nav { display: flex; gap: 4px; align-items: center; }
.main-nav a {
  padding: .5rem 1rem; border-radius: 999px; color: var(--ink-soft);
  font-weight: 500; transition: var(--transition);
}
.main-nav a:hover, .main-nav a.active { color: var(--rose); background: var(--rose-light); }

.header-actions { display: flex; align-items: center; gap: 10px; }
.search-form {
  display: flex; align-items: center; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px;
  transition: var(--transition);
}
.search-form:focus-within { border-color: var(--rose); box-shadow: 0 0 0 4px var(--rose-light); }
.search-form input {
  border: 0; outline: 0; background: transparent; padding: 8px 12px;
  font-family: inherit; font-size: .9rem; color: var(--ink); width: 220px;
}

/* mobile menu toggle */
.menu-toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.menu-toggle svg { width: 26px; height: 26px; }

@media (max-width: 880px) {
  .main-nav { display: none; }
  .menu-toggle { display: block; }
  .search-form input { width: 130px; }
  .main-nav.open {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; top: 100%; right: 0; left: 0;
    background: #fff; padding: 10px; border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
  }
  .main-nav.open a { padding: 12px; border-radius: var(--radius-sm); }
}

/* ====== HERO ====== */
.hero {
  position: relative; padding: 60px 0 80px;
  background:
    radial-gradient(1200px 400px at 100% 0%, var(--rose-light), transparent 50%),
    radial-gradient(1000px 400px at 0% 100%, #fff7ec, transparent 60%),
    var(--bg);
  overflow: hidden;
}
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 60px; align-items: center; }
.hero h1 { font-size: clamp(2.2rem, 4.4vw, 3.3rem); }
.hero h1 .accent { background: linear-gradient(135deg, var(--rose), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { color: var(--ink-soft); font-size: 1.1rem; max-width: 540px; }
.hero-ctas { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; }
.hero-art {
  position: relative; aspect-ratio: 1/1; border-radius: 32px;
  background: linear-gradient(135deg, #ffe8e0, var(--rose-light));
  display: grid; place-items: center; box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.hero-art::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.4), transparent 50%);
}
.hero-art .glyph { font-size: 14rem; filter: drop-shadow(0 12px 30px rgba(214,51,108,.3)); position: relative; }
.hero-badges { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.hero-badge {
  display: inline-flex; gap: 8px; padding: 8px 14px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); font-size: .85rem; box-shadow: var(--shadow-sm);
}

@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; gap: 30px; }
  .hero-art { max-width: 320px; margin: 0 auto; }
  .hero-art .glyph { font-size: 9rem; }
}

/* ====== CATEGORY STRIP ====== */
.section { padding: 60px 0; }
.section-title { display: flex; align-items: end; justify-content: space-between; margin-bottom: 30px; gap: 20px; flex-wrap: wrap; }
.section-title h2 { margin: 0; }
.section-title small { color: var(--muted); }
.section-title .link-more { color: var(--rose); font-weight: 600; }

.cats-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.cat-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 24px 12px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); text-align: center;
  transition: var(--transition);
}
.cat-card:hover { transform: translateY(-3px); border-color: var(--rose); box-shadow: var(--shadow); }
.cat-card .emoji { font-size: 2.4rem; }
.cat-card .name { font-weight: 600; color: var(--ink); }

/* ====== PRODUCT GRID ====== */
.product-grid {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.product-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: var(--transition); display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: transparent; }
.product-img {
  aspect-ratio: 4/5; background: var(--bg-2); position: relative; overflow: hidden;
}
.product-img img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s cubic-bezier(.23,1,.32,1);
}
.product-card:hover .product-img img { transform: scale(1.05); }
.product-img .placeholder {
  width: 100%; height: 100%; display: grid; place-items: center;
  font-size: 3rem; color: var(--muted); background: linear-gradient(135deg, #f6efe9, #fde7ef);
}
.product-img .badge {
  position: absolute; top: 12px; right: 12px;
  background: var(--rose); color: #fff; padding: 4px 10px;
  border-radius: 999px; font-size: .75rem; font-weight: 600;
}
.product-img .badge.sale { background: #dc2626; }
.product-img .badge.featured { background: var(--gold); top: 12px; left: 12px; right: auto; }
.product-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-cat { color: var(--muted); font-size: .78rem; }
.product-name { font-weight: 600; color: var(--ink); font-size: 1rem; line-height: 1.4; }
.product-price { display: flex; align-items: baseline; gap: 8px; margin-top: auto; padding-top: 8px; }
.product-price .now { font-weight: 800; color: var(--rose); font-size: 1.05rem; }
.product-price .was { text-decoration: line-through; color: var(--muted); font-size: .85rem; }
.product-stock {
  font-size: .75rem; color: #15803d;
}
.product-stock.low { color: #b45309; }
.product-stock.out { color: #dc2626; }

/* ====== PRODUCT DETAIL ====== */
.detail-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 50px; padding: 30px 0; }
@media (max-width: 880px) { .detail-grid { grid-template-columns: 1fr; gap: 24px; } }
.gallery { display: flex; flex-direction: column; gap: 12px; }
.gallery-main {
  aspect-ratio: 1/1; background: var(--bg-2); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line);
}
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.gallery-thumbs button {
  width: 64px; height: 64px; border-radius: 12px; border: 2px solid transparent;
  overflow: hidden; cursor: pointer; padding: 0; background: var(--bg-2);
  transition: var(--transition);
}
.gallery-thumbs button.active { border-color: var(--rose); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }

.detail-info h1 { margin-bottom: 8px; }
.detail-info .cat-tag { color: var(--muted); font-size: .9rem; margin-bottom: 14px; display: inline-block; }
.detail-info .price-block { margin: 20px 0; padding: 16px 18px; background: var(--rose-light); border-radius: var(--radius); }
.detail-info .price-block .now { font-size: 1.8rem; font-weight: 800; color: var(--rose); }
.detail-info .price-block .was { text-decoration: line-through; color: var(--muted); margin-inline-start: 12px; }
.detail-info .desc { color: var(--ink-soft); font-size: 1rem; }
.spec-row { display: flex; gap: 12px; margin: 8px 0; align-items: center; }
.spec-row .label { font-weight: 600; color: var(--ink-soft); min-width: 90px; }
.spec-row .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 4px 12px; background: #fff; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; }

/* ====== FORMS ====== */
.form-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; max-width: 980px;
}
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 14px; }
.form-row.full { grid-template-columns: 1fr; }
.form-row label { font-weight: 600; color: var(--ink-soft); font-size: .9rem; display: block; margin-bottom: 6px; }
.form-row input, .form-row textarea, .form-row select {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg-2);
  font-family: inherit; font-size: .95rem; color: var(--ink);
  transition: var(--transition);
}
.form-row input:focus, .form-row textarea:focus, .form-row select:focus {
  outline: 0; border-color: var(--rose); background: #fff;
  box-shadow: 0 0 0 4px var(--rose-light);
}
.form-row textarea { resize: vertical; min-height: 100px; }
.form-row .hint { color: var(--muted); font-size: .8rem; margin-top: 4px; }
.checkbox-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.checkbox-row label { display: flex; gap: 8px; align-items: center; margin: 0; cursor: pointer; }
@media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }

/* ====== ALERTS ====== */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-weight: 500; }
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ====== ADMIN ====== */
.admin-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.admin-sidebar {
  background: var(--ink); color: #fff; padding: 24px 16px; position: sticky; top: 0; height: 100vh;
}
.admin-sidebar .brand { color: #fff; }
.admin-sidebar .brand small { color: rgba(255,255,255,.6); }
.admin-sidebar nav { display: flex; flex-direction: column; gap: 4px; margin-top: 28px; }
.admin-sidebar nav a {
  padding: 11px 14px; border-radius: var(--radius-sm); color: rgba(255,255,255,.75);
  font-weight: 500; transition: var(--transition); display: flex; gap: 10px; align-items: center;
}
.admin-sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.admin-sidebar nav a.active { background: var(--rose); color: #fff; }
.admin-sidebar .sidebar-footer {
  position: absolute; bottom: 16px; right: 16px; left: 16px;
  padding-top: 16px; border-top: 1px solid rgba(255,255,255,.1);
  display: flex; justify-content: space-between; align-items: center; font-size: .85rem; color: rgba(255,255,255,.6);
}
.admin-main { padding: 28px; background: var(--bg-2); }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }
.admin-header h1 { margin: 0; font-size: 1.6rem; }

.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: #fff; border-radius: var(--radius); padding: 20px;
  border: 1px solid var(--line);
}
.stat-card .label { color: var(--muted); font-size: .85rem; }
.stat-card .value { font-size: 1.7rem; font-weight: 800; color: var(--ink); margin-top: 4px; }
.stat-card.danger .value { color: #dc2626; }
.stat-card.warn .value { color: #b45309; }
.stat-card.success .value { color: #15803d; }

.card { background: #fff; border-radius: var(--radius); border: 1px solid var(--line); padding: 22px; }
.card h2 { margin: 0 0 16px; font-size: 1.2rem; }

.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; }
table.data-table th, table.data-table td {
  padding: 12px 14px; text-align: right; border-bottom: 1px solid var(--line); font-size: .92rem;
}
table.data-table th { background: var(--bg-2); font-weight: 600; color: var(--ink-soft); }
table.data-table tr:last-child td { border-bottom: 0; }
table.data-table tr:hover td { background: rgba(214,51,108,.02); }

.thumb-tiny { width: 48px; height: 60px; border-radius: 8px; object-fit: cover; background: var(--bg-2); }
.badge {
  display: inline-flex; padding: 3px 10px; border-radius: 999px;
  font-size: .75rem; font-weight: 600;
}
.badge.green { background: #dcfce7; color: #166534; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.gold { background: #fef3c7; color: #854d0e; }

.gallery-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.gallery-edit .img-cell {
  position: relative; aspect-ratio: 1/1; border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--line);
}
.gallery-edit .img-cell img { width: 100%; height: 100%; object-fit: cover; }
.gallery-edit form {
  position: absolute; top: 6px; left: 6px;
}
.gallery-edit .img-cell button {
  background: rgba(255,255,255,.9); border: 0; padding: 4px 8px; border-radius: 6px;
  cursor: pointer; font-size: .75rem; color: #dc2626;
}

.upload-drop {
  border: 2px dashed var(--line); border-radius: var(--radius-sm); padding: 24px;
  text-align: center; color: var(--muted); cursor: pointer; transition: var(--transition);
  background: var(--bg-2);
}
.upload-drop:hover { border-color: var(--rose); background: var(--rose-light); color: var(--rose); }

@media (max-width: 880px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: relative; height: auto; }
  .admin-sidebar .sidebar-footer { position: static; margin-top: 20px; }
  .admin-sidebar nav { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .admin-sidebar nav a { padding: 8px 12px; font-size: .85rem; }
  .admin-sidebar nav span { display: none; }
}

/* ====== LOGIN ====== */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 30px;
  background: linear-gradient(135deg, var(--rose-light), #fef3c7);
}
.login-card {
  background: #fff; padding: 40px; border-radius: 22px; max-width: 420px; width: 100%;
  box-shadow: var(--shadow-lg);
}
.login-card .brand { justify-content: center; margin-bottom: 24px; }

/* ====== FOOTER ====== */
.site-footer {
  background: var(--ink); color: rgba(255,255,255,.8);
  padding: 50px 0 30px; margin-top: 60px;
}
.site-footer .footer-grid {
  display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 30px; margin-bottom: 30px;
}
.site-footer h4 { color: #fff; margin-bottom: 14px; font-size: .95rem; }
.site-footer a { color: rgba(255,255,255,.65); display: block; padding: 4px 0; }
.site-footer a:hover { color: #fff; }
.site-footer .footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding-top: 20px; text-align: center; font-size: .85rem; color: rgba(255,255,255,.5); }
@media (max-width: 700px) { .site-footer .footer-grid { grid-template-columns: 1fr 1fr; } }

/* ====== FLOATING WHATSAPP ====== */
.whatsapp-float {
  position: fixed; bottom: 24px; left: 24px; z-index: 70;
  width: 60px; height: 60px; border-radius: 50%;
  background: #25D366; color: #fff; display: grid; place-items: center;
  box-shadow: 0 10px 30px rgba(37,211,102,.4);
  transition: var(--transition); font-size: 1.6rem;
}
.whatsapp-float:hover { transform: scale(1.08); }

/* ====== EMPTY STATE ====== */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--muted);
}
.empty-state .glyph { font-size: 4rem; margin-bottom: 12px; }

/* ====== UTILITIES ====== */
.muted { color: var(--muted); }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 24px; }
.mt-2 { margin-top: 12px; }
.mt-4 { margin-top: 24px; }
.flex { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ====== ANIMATIONS ====== */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeUp .5s cubic-bezier(.23,1,.32,1) both; }


/* ===== Per-size variant editor (admin) ===== */
.variants-box { display: grid; gap: 8px; }
.variant-row { display: grid; grid-template-columns: 2fr 1fr auto; gap: 8px; align-items: center; }
.variant-row input { padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; }
.variant-row .btn-remove-variant { height: 38px; line-height: 1; padding: 0 12px; }
.upload-drop { display: block; padding: 24px; border: 2px dashed var(--line); border-radius: var(--radius); text-align: center; cursor: pointer; background: var(--bg-2); transition: var(--transition); }
.upload-drop:hover { border-color: var(--rose); background: var(--rose-light); }
.gallery-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 10px; }
.gallery-edit .img-cell { position: relative; aspect-ratio: 4/5; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); }
.gallery-edit .img-cell img { width: 100%; height: 100%; object-fit: cover; }
.gallery-edit .img-cell form { position: absolute; bottom: 6px; left: 6px; margin: 0; }
.gallery-edit .img-cell button { background: rgba(220,38,38,.92); color: #fff; border: 0; padding: 4px 10px; border-radius: 6px; font-size: .75rem; cursor: pointer; }
.mb-2 { margin-bottom: 8px; } .mt-2 { margin-top: 8px; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.gold { background: #fef3c7; color: #92400e; }

/* ===== Public size chips with per-size stock ===== */
.chip-stock {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  margin-inline-start: 6px; font-size: .72rem; font-weight: 700;
  background: #15803d; color: #fff;
}
.chip-stock.low { background: #b45309; }
.chip.chip-out { opacity: .55; text-decoration: line-through; }
.chip.chip-out .chip-stock { background: #dc2626; text-decoration: none; }


/* ============= Dashboard button (public header) ============= */
.dashboard-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--rose), var(--rose-dark));
  color: #fff !important;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(214, 51, 108, 0.25);
  transition: transform .16s cubic-bezier(0.23, 1, 0.32, 1), box-shadow .16s ease-out;
  white-space: nowrap;
}
.dashboard-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(214, 51, 108, 0.35);
}
.dashboard-link:active { transform: scale(0.97); }
.dashboard-link svg { flex: 0 0 auto; }
@media (max-width: 720px) {
  .dashboard-link span { display: none; }
  .dashboard-link { padding: 9px 11px; }
}

/* ============= Improved flash (toast-like) ============= */
.flash {
  position: relative;
  padding: 14px 22px 14px 48px;
  border-radius: 12px;
  margin: 0 0 18px 0;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid;
  animation: flashSlide .35s cubic-bezier(0.23, 1, 0.32, 1);
  box-shadow: 0 4px 14px rgba(0,0,0,.06);
}
.flash::before {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  line-height: 22px;
  text-align: center;
}
.flash-success { background: #ecfdf3; color: #027948; border-color: #a7f0c8; }
.flash-success::before { content: "✓"; background: #16a34a; }
.flash-error { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.flash-error::before { content: "!"; background: #dc2626; }
@keyframes flashSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============= Save button loading state ============= */
.btn[data-loading="true"] {
  position: relative;
  color: transparent !important;
  pointer-events: none;
  opacity: 0.85;
}
.btn[data-loading="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btnSpin .7s linear infinite;
}
@keyframes btnSpin { to { transform: rotate(360deg); } }


/* ============================================================
   MOBILE RESPONSIVE — Full overhaul for screens ≤ 880px
   ============================================================ */

/* Desktop: show brand, hide hamburger toggle and bottom nav */
.sidebar-toggle { display: none; }
.sidebar-top-bar { display: flex; align-items: center; padding: 18px 16px 8px; }
.sidebar-top-bar .brand { flex: 1; }
.mobile-bottom-nav { display: none; }

/* ── Admin sidebar: collapsible hamburger on mobile ── */
@media (max-width: 880px) {
  .admin-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .admin-sidebar {
    position: relative;
    height: auto;
    padding: 0;
    overflow: hidden;
  }

  /* Top bar inside sidebar */
  .admin-sidebar .sidebar-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,.1);
  }

  .admin-sidebar .brand { padding: 0; }

  /* Hamburger toggle button */
  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px; height: 44px;
    background: rgba(255,255,255,.12);
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    color: #fff;
    flex-shrink: 0;
  }

  /* Nav links: hidden by default, shown when .open */
  .admin-sidebar nav {
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    display: none;
    margin-top: 0;
  }
  .admin-sidebar.open nav { display: flex; }
  .admin-sidebar.open {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
  }
  /* Overlay behind open sidebar */
  .admin-sidebar.open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: -1;
  }

  .admin-sidebar nav a {
    padding: 14px 16px;
    font-size: 1rem;
    border-radius: 10px;
    min-height: 48px;
  }
  /* Show text labels on mobile */
  .admin-sidebar nav span { display: inline !important; }

  .admin-sidebar .sidebar-footer {
    position: static;
    padding: 12px 16px;
    margin-top: 0;
    border-top: 1px solid rgba(255,255,255,.1);
    display: none;
  }
  .admin-sidebar.open .sidebar-footer { display: flex; }

  /* Show mobile bottom nav */
  .mobile-bottom-nav { display: flex; }

  /* Main content area */
  .admin-main { padding: 14px; }
  .admin-header { margin-bottom: 14px; gap: 10px; }
  .admin-header h1 { font-size: 1.25rem; }

  /* Buttons in admin header: touch-friendly */
  .admin-header .btn {
    min-height: 44px;
    padding: .55rem 1rem;
    font-size: .9rem;
  }
}

/* ── Tables: horizontal scroll + larger touch targets ── */
@media (max-width: 880px) {
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    /* subtle scroll hint */
    background:
      linear-gradient(to right, white 30%, rgba(255,255,255,0)),
      linear-gradient(to right, rgba(255,255,255,0), white 70%) 0 100%,
      radial-gradient(farthest-side at 0% 50%, rgba(0,0,0,.08), transparent),
      radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.08), transparent) 0 100%;
    background-repeat: no-repeat;
    background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
    background-attachment: local, local, scroll, scroll;
  }

  /* Admin table */
  table.admin-table, table.data-table {
    min-width: 560px;
    font-size: .82rem;
  }
  table.admin-table th, table.admin-table td,
  table.data-table th, table.data-table td {
    padding: 10px 10px;
    white-space: nowrap;
  }

  /* Stat cards: 2 columns on mobile */
  .admin-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .value { font-size: 1.4rem; }

  /* Forms: single column */
  .form-row { grid-template-columns: 1fr; }
  .form-card { padding: 16px; }

  /* All form inputs: touch-friendly */
  .form-row input,
  .form-row textarea,
  .form-row select,
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="password"],
  select,
  textarea {
    min-height: 46px;
    font-size: 16px !important; /* prevents iOS zoom */
    padding: 12px 14px;
  }
  textarea { min-height: 80px; }

  /* Order form layout: product picker on top, form below */
  .order-layout { grid-template-columns: 1fr; }
  .order-picker { position: static; max-height: 45vh; overflow-y: auto; }

  /* Order detail */
  .order-detail-layout { grid-template-columns: 1fr; }

  /* Summary bar */
  .summary-bar { flex-direction: row; flex-wrap: wrap; gap: 10px; }
  .summary-card { flex: 1 1 calc(50% - 10px); min-width: 130px; padding: 12px 14px; }
  .s-value { font-size: 18px; }

  /* Variant rows */
  .variant-row { grid-template-columns: 1.5fr 1fr auto; gap: 6px; }

  /* Card padding */
  .card { padding: 14px; }

  /* Alert/flash */
  .alert, .flash { font-size: .88rem; }

  /* Admin header action buttons wrap nicely */
  .admin-header > div:last-child { flex-wrap: wrap; }

  /* Order detail: action buttons stack on mobile */
  .order-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .order-detail-actions .btn {
    flex: 1 1 auto;
    min-height: 44px;
    justify-content: center;
    font-size: .88rem;
  }

  /* Order items in form: better touch targets */
  .oi-qty-btn {
    width: 38px !important;
    height: 38px !important;
    font-size: 20px !important;
  }
  .oi-remove {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Size modal: full-width on mobile */
  .size-modal-overlay { align-items: flex-end; padding: 0; }
  .size-modal {
    border-radius: 20px 20px 0 0;
    min-width: unset;
    width: 100%;
    max-width: 100%;
    padding: 24px 20px 32px;
    max-height: 80vh;
    overflow-y: auto;
  }
  .size-opt {
    padding: 14px 18px !important;
    font-size: 16px !important;
    min-height: 52px;
  }
  .size-modal-actions .btn {
    flex: 1;
    min-height: 48px;
    justify-content: center;
  }

  /* Order form: totals section */
  .total-row input[type=number] { width: 100% !important; }
  .total-row input[type=text] { width: 100% !important; }
  .total-row { flex-wrap: wrap; gap: 6px; }
  .discount-row, .discount-note-row { flex-direction: column; align-items: stretch; }
  .discount-row label, .discount-note-row label { margin-bottom: 4px; }

  /* Products page: image thumbnails */
  .thumb-tiny { width: 40px; height: 50px; }

  /* Gallery edit: smaller thumbnails on mobile */
  .gallery-edit { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }

  /* Upload drop area */
  .upload-drop { padding: 18px 12px; font-size: .9rem; }

  /* Btn-delete-image: easier to tap */
  .btn-delete-image {
    padding: 6px 10px !important;
    font-size: .8rem !important;
    min-height: 36px;
  }

  /* Status buttons in order detail */
  .btn-xs {
    min-height: 36px !important;
    padding: 6px 12px !important;
    font-size: .82rem !important;
  }

  /* order-form: submit button full width */
  #submitOrderBtn { width: 100%; justify-content: center; min-height: 50px; font-size: 1rem; }

  /* product-form submit */
  #productForm > div:last-of-type .btn { min-height: 48px; }
}

/* ── Public store: header & nav ── */
@media (max-width: 768px) {
  .header-inner { padding: 10px 0; gap: 10px; }

  /* Shrink search bar */
  .search-form input { width: 100px; font-size: .85rem; }
  .search-form { padding: 3px 8px; }

  /* Hero */
  .hero { padding: 36px 0 48px; }
  .hero-grid { grid-template-columns: 1fr; gap: 20px; }
  .hero-art { max-width: 260px; margin: 0 auto; }
  .hero-art .glyph { font-size: 7rem; }
  .hero-ctas { gap: 8px; }
  .hero-ctas .btn { font-size: .9rem; padding: .65rem 1.1rem; }
  .hero-badges { gap: 6px; }
  .hero-badge { font-size: .78rem; padding: 6px 10px; }

  /* Sections */
  .section { padding: 36px 0; }
  .section-title { margin-bottom: 18px; }

  /* Category grid: 3 columns on mobile */
  .cats-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .cat-card { padding: 14px 8px; }
  .cat-card .emoji { font-size: 1.8rem; }
  .cat-card .name { font-size: .8rem; }

  /* Product grid: 2 columns */
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .product-body { padding: 10px 12px 12px; }
  .product-name { font-size: .9rem; }
  .product-price .now { font-size: .95rem; }

  /* Product detail */
  .detail-grid { grid-template-columns: 1fr; gap: 20px; padding: 16px 0; }
  .gallery-thumbs button { width: 52px; height: 52px; }
  .detail-info .price-block .now { font-size: 1.5rem; }

  /* Footer */
  .site-footer { padding: 36px 0 20px; margin-top: 36px; }
  .site-footer .footer-grid { grid-template-columns: 1fr 1fr; gap: 20px; }

  /* WhatsApp float */
  .whatsapp-float { bottom: 16px; left: 16px; width: 52px; height: 52px; font-size: 1.4rem; }

  /* Container padding */
  .container { padding: 0 14px; }

  /* Login card */
  .login-card { padding: 24px 20px; }
}

/* ── Extra small (≤ 400px) ── */
@media (max-width: 400px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .cats-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-art { max-width: 200px; }
  .hero-art .glyph { font-size: 5.5rem; }
  .admin-stats { grid-template-columns: 1fr 1fr; }
  .stat-card .value { font-size: 1.2rem; }
  .admin-main { padding: 10px; }
  .card { padding: 12px; }
  .form-card { padding: 12px; }
  .summary-card { flex: 1 1 100%; }
}

/* ============================================================
   MOBILE BOTTOM NAVIGATION BAR
   ============================================================ */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 880px) {
  /* Show bottom nav on mobile */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    z-index: 200;
    background: #fff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 20px rgba(0,0,0,.08);
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transition: transform .25s cubic-bezier(.23,1,.32,1);
  }
  .mobile-bottom-nav.hidden {
    transform: translateY(100%);
  }

  .mbn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 10px 4px 8px;
    color: #9ca3af;
    font-size: .68rem;
    font-weight: 600;
    text-decoration: none;
    transition: color .15s;
    min-height: 56px;
    position: relative;
  }
  .mbn-item span { line-height: 1; }
  .mbn-item.active {
    color: var(--rose);
  }
  .mbn-item.active svg {
    stroke: var(--rose);
  }
  .mbn-item svg {
    stroke: #9ca3af;
    transition: stroke .15s;
  }

  /* Center FAB button */
  .mbn-item.mbn-add {
    flex: 0 0 64px;
    padding: 0;
    margin-top: -18px;
  }
  .mbn-item.mbn-add svg {
    width: 26px;
    height: 26px;
    stroke: #fff;
  }
  .mbn-item.mbn-add::before {
    content: '';
    position: absolute;
    inset: 0;
    top: -18px;
    width: 56px;
    height: 56px;
    margin: 0 auto;
    background: linear-gradient(135deg, var(--rose), var(--rose-dark));
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(214,51,108,.4);
    z-index: -1;
  }
  .mbn-item.mbn-add:active::before {
    transform: scale(0.94);
  }

  /* Add bottom padding to main content so it doesn't hide behind nav */
  .admin-main {
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Hide the old sidebar nav on mobile (use bottom nav instead) */
  /* Sidebar still accessible via hamburger for less-used items */
}

/* ============================================================
   MOBILE DASHBOARD: Better stat cards
   ============================================================ */
@media (max-width: 880px) {
  .admin-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat-card {
    padding: 14px 12px;
    border-radius: 14px;
  }
  .stat-card .label { font-size: .78rem; }
  .stat-card .value { font-size: 1.5rem; }

  /* Better card for recent orders on dashboard */
  .card { border-radius: 14px; }

  /* Admin header: title + button on same row, smaller */
  .admin-header {
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
  }
  .admin-header h1 { font-size: 1.2rem; }
  .admin-header p.muted { font-size: .8rem; margin: 0; }
  .admin-header .btn {
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 42px;
    padding: .5rem .9rem;
    font-size: .88rem;
  }
}
