/* ========== RESET & VARS ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --rose:    #e8436a;
  --rose-dk: #c7294f;
  --gold:    #d4a853;
  --gold-lt: #f5dfa0;
  --cream:   #fdf6ee;
  --dark:    #1a1010;
  --muted:   #7a6060;
  --card-bg: #fff;
  --shadow:  0 4px 24px rgba(0,0,0,.09);
  --radius:  16px;
  --wa:      #25D366;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--dark);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* ========== HEADER ========== */
.header {
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 2px solid var(--gold-lt);
  box-shadow: 0 2px 16px rgba(0,0,0,.06);
}
.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo-block { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 28px; }
.logo-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 900;
  color: var(--rose);
  line-height: 1;
}
.logo-sub {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: .5px;
}
.header-right { display: flex; align-items: center; gap: 10px; }

.cart-btn {
  background: var(--rose);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 10px 18px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  transition: background .2s;
}
.cart-btn:active { background: var(--rose-dk); }
.cart-count {
  background: #fff;
  color: var(--rose);
  border-radius: 50%;
  width: 22px; height: 22px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.admin-link {
  font-size: 22px;
  text-decoration: none;
  opacity: .4;
  transition: opacity .2s;
}
.admin-link:hover { opacity: 1; }

/* ========== SEARCH ========== */
.search-bar {
  max-width: 900px;
  margin: 20px auto 0;
  padding: 0 16px;
}
.search-bar input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--gold-lt);
  border-radius: 50px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  background: #fff;
  outline: none;
  transition: border .2s;
}
.search-bar input:focus { border-color: var(--rose); }

/* ========== CATEGORIES ========== */
.categories {
  max-width: 900px;
  margin: 14px auto 0;
  padding: 0 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.categories::-webkit-scrollbar { display: none; }
.cat-btn {
  border: 2px solid var(--gold-lt);
  background: #fff;
  color: var(--muted);
  padding: 7px 18px;
  border-radius: 50px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s;
}
.cat-btn.active, .cat-btn:active {
  background: var(--rose);
  border-color: var(--rose);
  color: #fff;
}

/* ========== PRODUCTS GRID ========== */
.products-grid {
  max-width: 900px;
  margin: 20px auto 120px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (min-width: 600px) {
  .products-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 860px) {
  .products-grid { grid-template-columns: repeat(4, 1fr); }
}

.empty-state {
  grid-column: 1/-1;
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-icon { font-size: 60px; margin-bottom: 12px; }
.empty-state p { font-size: 16px; margin-bottom: 6px; }
.empty-state small { font-size: 13px; }

/* ========== PRODUCT CARD ========== */
.product-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .18s, box-shadow .18s;
  position: relative;
  animation: fadeUp .35s ease both;
}
.product-card:active { transform: scale(.97); }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.product-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: var(--cream);
}
.product-img-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--gold-lt), #fcecd5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}
.product-info { padding: 10px 12px 12px; }
.product-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--dark);
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-price {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--rose);
}
.product-price span { font-size: 12px; font-weight: 400; color: var(--muted); }
.product-cat-tag {
  display: inline-block;
  background: var(--gold-lt);
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 50px;
  margin-bottom: 5px;
}
.quick-add {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: var(--rose);
  color: #fff;
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 32px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(232,67,106,.35);
  transition: background .15s, transform .1s;
  display: flex; align-items: center; justify-content: center;
}
.quick-add:active { background: var(--rose-dk); transform: scale(.9); }

/* ========== CART PANEL ========== */
.cart-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 300;
}
.cart-overlay.open { display: block; }

.cart-panel {
  position: fixed;
  top: 0; right: -100%;
  height: 100%;
  width: min(400px, 100%);
  background: #fff;
  z-index: 400;
  display: flex;
  flex-direction: column;
  transition: right .3s cubic-bezier(.4,0,.2,1);
  box-shadow: -4px 0 32px rgba(0,0,0,.15);
}
.cart-panel.open { right: 0; }

.cart-header {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--cream);
}
.cart-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--rose);
}
.close-cart {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--muted);
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.close-cart:hover { background: var(--cream); }

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cart-empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
  font-size: 16px;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--cream);
  border-radius: 12px;
  padding: 10px 12px;
}
.cart-item-img {
  width: 52px; height: 52px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--gold-lt);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cart-item-price { font-size: 13px; color: var(--rose); font-weight: 600; }

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cart-item-qty button {
  background: #fff;
  border: 1.5px solid var(--gold-lt);
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--dark);
  transition: background .15s;
}
.cart-item-qty button:active { background: var(--rose); color: #fff; border-color: var(--rose); }
.cart-item-qty span { font-weight: 700; font-size: 15px; min-width: 20px; text-align: center; }

.remove-item { font-size: 18px; cursor: pointer; color: var(--muted); padding: 4px; }

.cart-footer {
  padding: 16px 20px;
  border-top: 2px solid var(--cream);
}
.cart-total {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 12px;
  text-align: center;
}
.cart-total strong { font-family: 'Playfair Display', serif; font-size: 22px; color: var(--rose); }

.client-info { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.client-info input {
  padding: 12px 16px;
  border: 2px solid var(--gold-lt);
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  outline: none;
}
.client-info input:focus { border-color: var(--rose); }

.whatsapp-btn {
  width: 100%;
  background: var(--wa);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background .2s, transform .1s;
  box-shadow: 0 4px 16px rgba(37,211,102,.35);
}
.whatsapp-btn:active { background: #1da851; transform: scale(.98); }

/* ========== PRODUCT MODAL ========== */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 500;
}
.modal-overlay.open { display: block; }

.product-modal {
  position: fixed;
  bottom: -100%;
  left: 0; right: 0;
  background: #fff;
  border-radius: 24px 24px 0 0;
  z-index: 600;
  transition: bottom .3s cubic-bezier(.4,0,.2,1);
  max-height: 85vh;
  overflow-y: auto;
}
.product-modal.open { bottom: 0; }
.product-modal img {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
}
.modal-close {
  position: absolute;
  top: 14px; right: 16px;
  background: rgba(0,0,0,.4);
  color: #fff;
  border: none;
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  z-index: 10;
  display: flex; align-items: center; justify-content: center;
}
.modal-info { padding: 20px; }
.modal-info h3 { font-family: 'Playfair Display', serif; font-size: 22px; margin-bottom: 6px; }
.modal-price { font-size: 20px; color: var(--rose); font-weight: 700; margin-bottom: 16px; }
.modal-qty {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}
.modal-qty button {
  background: var(--cream);
  border: 2px solid var(--gold-lt);
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--dark);
}
.modal-qty span { font-size: 24px; font-weight: 700; min-width: 36px; text-align: center; }

.add-to-cart-btn {
  width: 100%;
  background: var(--rose);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s;
}
.add-to-cart-btn:active { background: var(--rose-dk); }

/* ========== ADMIN ========== */
.admin-body { background: #f5f5f7; }

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--rose) 0%, var(--rose-dk) 50%, #8b1a3a 100%);
}
.login-card {
  background: #fff;
  border-radius: 24px;
  padding: 40px 32px;
  width: min(380px, 90vw);
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.login-logo { font-size: 48px; margin-bottom: 12px; }
.login-card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  color: var(--rose);
  margin-bottom: 6px;
}
.login-card p { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.login-card input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--gold-lt);
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  outline: none;
  margin-bottom: 12px;
  text-align: center;
}
.login-card input:focus { border-color: var(--rose); }
.login-card button {
  width: 100%;
  padding: 14px;
  background: var(--rose);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s;
}
.login-card button:hover { background: var(--rose-dk); }
.login-error {
  color: var(--rose);
  font-size: 13px;
  margin-top: 10px;
  display: none;
}

/* ADMIN DASHBOARD */
.admin-header { background: #fff; border-bottom: 2px solid var(--gold-lt); }
.admin-header-actions { display: flex; gap: 10px; align-items: center; }
.refresh-btn {
  background: none;
  border: 1.5px solid var(--gold);
  font-size: 18px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s;
}
.refresh-btn:hover {
  background: var(--gold-lt);
  transform: rotate(180deg);
}
.view-site-btn {
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  border: 1.5px solid var(--gold-lt);
  border-radius: 8px;
}
.logout-btn {
  background: none;
  border: 1.5px solid var(--rose);
  color: var(--rose);
  padding: 8px 14px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.admin-stats {
  display: flex;
  gap: 14px;
  max-width: 900px;
  margin: 24px auto 0;
  padding: 0 16px;
}
.stat-card {
  flex: 1;
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-num {
  font-family: 'Playfair Display', serif;
  font-size: 36px;
  font-weight: 900;
  color: var(--rose);
}
.stat-label { font-size: 13px; color: var(--muted); font-weight: 500; }

.admin-actions {
  max-width: 900px;
  margin: 20px auto 0;
  padding: 0 16px;
}
.add-product-btn {
  background: var(--rose);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 16px 28px;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: center;
  transition: background .2s;
  box-shadow: 0 4px 16px rgba(232,67,106,.3);
}
.add-product-btn span { font-size: 22px; }
.add-product-btn:hover { background: var(--rose-dk); }

.admin-products {
  max-width: 900px;
  margin: 20px auto 60px;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-product-card {
  background: #fff;
  border-radius: 16px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  animation: fadeUp .3s ease both;
}
.admin-prod-img {
  width: 72px; height: 72px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--gold-lt);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
}
.admin-prod-info { flex: 1; min-width: 0; }
.admin-prod-name { font-weight: 700; font-size: 16px; margin-bottom: 2px; }
.admin-prod-meta { font-size: 13px; color: var(--muted); }
.admin-prod-price { font-family: 'Playfair Display', serif; font-size: 18px; color: var(--rose); font-weight: 700; }
.admin-prod-actions { display: flex; flex-direction: column; gap: 6px; }
.edit-btn, .del-btn {
  padding: 7px 14px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s;
}
.edit-btn { background: var(--gold-lt); color: #7a5a00; }
.edit-btn:hover { background: var(--gold); color: #fff; }
.del-btn { background: #fdecea; color: #c7294f; }
.del-btn:hover { background: var(--rose); color: #fff; }

/* ADD PRODUCT MODAL */
.add-modal {
  position: fixed;
  bottom: -100%;
  left: 0; right: 0;
  background: #fff;
  border-radius: 24px 24px 0 0;
  z-index: 600;
  transition: bottom .3s cubic-bezier(.4,0,.2,1);
  max-height: 90vh;
  overflow-y: auto;
  padding-bottom: 30px;
}
.add-modal.open { bottom: 0; }
.add-modal-header {
  padding: 20px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.add-modal-header h3 { font-family: 'Playfair Display', serif; font-size: 22px; color: var(--rose); }

.add-step { padding: 0 20px; }
.step-label {
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.photo-options { display: flex; gap: 14px; margin-bottom: 20px; }
.photo-btn {
  flex: 1;
  padding: 28px 16px;
  border: 2.5px dashed var(--gold-lt);
  background: var(--cream);
  border-radius: 16px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: border-color .2s, background .2s;
}
.photo-btn span { font-size: 36px; }
.photo-btn:active { border-color: var(--rose); background: #fff5f7; }

.photo-preview-wrap {
  margin-bottom: 20px;
  text-align: center;
}
.photo-preview-wrap img {
  width: 100%;
  max-height: 250px;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 10px;
}
.change-photo-btn {
  background: none;
  border: 1.5px solid var(--rose);
  color: var(--rose);
  padding: 8px 20px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  cursor: pointer;
}

.step-nav { display: flex; gap: 10px; margin-top: 16px; }
.step-next-btn {
  flex: 1;
  background: var(--rose);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s;
}
.step-next-btn:disabled { background: #ddd; cursor: not-allowed; }
.step-next-btn:not(:disabled):hover { background: var(--rose-dk); }
.step-back-btn {
  background: var(--cream);
  color: var(--muted);
  border: none;
  border-radius: 12px;
  padding: 14px 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.form-group input, .form-group textarea {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid var(--gold-lt);
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  outline: none;
  background: #fff;
  transition: border .2s;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--rose); }
.form-group textarea { resize: vertical; }
.form-error { color: var(--rose); font-size: 13px; margin-bottom: 8px; }

/* CONFIRM BOX */
.confirm-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 700;
}
.confirm-overlay.open { display: block; }
.confirm-box {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -60%);
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px;
  z-index: 800;
  text-align: center;
  width: min(320px, 90vw);
  display: none;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.confirm-box.open { display: block; transform: translate(-50%, -50%); }
.confirm-box p { font-size: 17px; font-weight: 600; margin-bottom: 20px; }
.confirm-btns { display: flex; gap: 10px; }
.confirm-btns button {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.confirm-btns button:first-child { background: var(--cream); color: var(--muted); }
.confirm-del { background: var(--rose) !important; color: #fff !important; }

/* TOAST */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--dark);
  color: #fff;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transition: all .3s;
  z-index: 999;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
