/* ══════════════════════════════════════════════════
   la Mona — Panel de administración
   Mismo sistema de diseño que styles.css
══════════════════════════════════════════════════ */
:root {
  --bg:          #faf5f0;
  --bg-alt:      #f5ede6;
  --accent:      #c07890;
  --accent-dark: #a05c72;
  --gold:        #c8a060;
  --text:        #1a1012;
  --text-muted:  #6b5058;
  --text-light:  #9c7880;
  --white:       #ffffff;
  --danger:      #c0504d;
  --ok:          #5d8a66;
  --radius:      18px;
  --radius-sm:   10px;
  --radius-pill: 999px;
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --t: 0.3s;
  --shadow: 0 4px 24px rgba(26, 16, 18, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}
[hidden] { display: none !important; }
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }

/* ══════════ Botones ══════════ */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 11px 22px;
  font-weight: 600;
  font-size: 0.92rem;
  transition: background var(--t) var(--ease), transform var(--t) var(--ease);
}
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.55; cursor: wait; transform: none; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(107, 80, 88, 0.3);
  border-radius: var(--radius-pill);
  padding: 10px 20px;
  font-weight: 500;
  font-size: 0.92rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: border-color var(--t), color var(--t), background var(--t);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-dark); background: rgba(192, 120, 144, 0.06); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(192, 80, 77, 0.4);
  border-radius: var(--radius-pill);
  padding: 11px 22px;
  font-weight: 600;
  font-size: 0.92rem;
  transition: background var(--t), color var(--t);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* ══════════ Campos ══════════ */
.field { display: block; margin-bottom: 16px; }
.field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--white);
  border: 1px solid rgba(107, 80, 88, 0.22);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 0.95rem;
  transition: border-color var(--t), box-shadow var(--t);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(192, 120, 144, 0.16);
}
.field textarea { resize: vertical; min-height: 90px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ══════════ LOGIN ══════════ */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(192, 120, 144, 0.12), transparent 55%),
    radial-gradient(ellipse at 85% 90%, rgba(200, 160, 96, 0.10), transparent 55%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 410px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 42px 36px 36px;
  text-align: center;
  position: relative;
}
.login-back {
  position: absolute;
  top: 18px; left: 22px;
  font-size: 0.82rem;
  color: var(--text-light);
  text-decoration: none;
}
.login-back:hover { color: var(--accent-dark); }
.login-logo { margin: 0 auto 14px; border-radius: 50%; }
.login-title {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: 1.75rem;
  margin-bottom: 4px;
}
.login-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 26px; }
.login-card form { text-align: left; }
.login-error {
  color: var(--danger);
  font-size: 0.86rem;
  margin: -4px 0 14px;
}
.login-demo {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px dashed rgba(107, 80, 88, 0.25);
}
.login-demo p {
  font-size: 0.83rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-align: left;
}

/* ══════════ TOPBAR ══════════ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 28px;
  background: rgba(250, 245, 240, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(107, 80, 88, 0.12);
}
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.topbar-brand img { border-radius: 50%; }
.topbar-brand strong {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.25rem;
  display: block;
  line-height: 1.1;
}
.topbar-brand span { font-size: 0.74rem; color: var(--text-light); letter-spacing: 0.05em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar-user { font-size: 0.84rem; color: var(--text-muted); }

.btn-save-all {
  background: var(--ok);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  font-weight: 600;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  animation: pulse-save 2s infinite;
}
.btn-save-all:hover { filter: brightness(1.08); }
.save-all-badge {
  background: rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-pill);
  padding: 1px 8px;
  font-size: 0.8rem;
}
@keyframes pulse-save {
  0%, 100% { box-shadow: 0 0 0 0 rgba(93, 138, 102, 0.45); }
  55%      { box-shadow: 0 0 0 9px rgba(93, 138, 102, 0); }
}

/* ══════════ BANNERS ══════════ */
.demo-banner, .import-banner {
  margin: 16px 28px 0;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}
.demo-banner {
  background: #fdf3e3;
  border: 1px solid rgba(200, 160, 96, 0.45);
  color: #7a5c2e;
}
.demo-banner code { background: rgba(200, 160, 96, 0.18); padding: 1px 6px; border-radius: 5px; font-size: 0.82rem; }
.import-banner {
  background: #eef4ef;
  border: 1px solid rgba(93, 138, 102, 0.4);
  color: #3d5c44;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

/* ══════════ TOOLBAR ══════════ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 20px 28px 6px;
}
.toolbar-search {
  position: relative;
  flex: 1 1 240px;
  max-width: 360px;
}
.toolbar-search svg {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}
.toolbar-search input {
  width: 100%;
  background: var(--white);
  border: 1px solid rgba(107, 80, 88, 0.22);
  border-radius: var(--radius-pill);
  padding: 10px 16px 10px 40px;
  font-size: 0.92rem;
}
.toolbar-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(192, 120, 144, 0.16);
}
.toolbar-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.toolbar-filters button {
  background: transparent;
  border: 1px solid rgba(107, 80, 88, 0.25);
  border-radius: var(--radius-pill);
  padding: 7px 15px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--t) var(--ease);
}
.toolbar-filters button:hover { border-color: var(--accent); color: var(--accent-dark); }
.toolbar-filters button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.toolbar-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.product-count { font-size: 0.84rem; color: var(--text-light); }

/* ══════════ GRID DE PRODUCTOS ══════════ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 18px;
  padding: 18px 28px 60px;
}
.grid-empty { text-align: center; color: var(--text-light); padding: 60px 20px; }

.p-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(26, 16, 18, 0.05);
  border: 1px solid rgba(107, 80, 88, 0.08);
  cursor: pointer;
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
  position: relative;
}
.p-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.p-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.p-card.inactive { opacity: 0.55; }
.p-card.dirty { border-color: var(--ok); box-shadow: 0 0 0 2px rgba(93, 138, 102, 0.35); }

.p-card-img {
  aspect-ratio: 1 / 1;
  background: var(--bg-alt);
  overflow: hidden;
}
.p-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.45s var(--ease); }
.p-card:hover .p-card-img img { transform: scale(1.05); }

.p-card-tag {
  position: absolute;
  top: 10px; left: 10px;
  background: rgba(250, 245, 240, 0.92);
  color: var(--accent-dark);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}
.p-card-dirty-dot {
  position: absolute;
  top: 10px; right: 10px;
  background: var(--ok);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
}
.p-card-off {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(26, 16, 18, 0.65);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
}

.p-card-body { padding: 13px 15px 15px; }
.p-card-cat {
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 2px;
}
.p-card-name {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.p-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.p-card-price { font-weight: 600; color: var(--gold); }

/* ══════════ DRAWER (editor) ══════════ */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 16, 18, 0.45);
  z-index: 90;
  animation: fade-in 0.25s var(--ease);
}
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(460px, 100vw);
  background: var(--bg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 40px rgba(26, 16, 18, 0.18);
  animation: slide-in 0.3s var(--ease);
}
@keyframes slide-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes fade-in  { from { opacity: 0; } to { opacity: 1; } }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(107, 80, 88, 0.12);
  background: var(--white);
}
.drawer-head h2 {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.4rem;
  font-weight: 600;
}
.drawer-close {
  background: var(--bg-alt);
  border: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 0.95rem;
  color: var(--text-muted);
  transition: background var(--t), color var(--t);
}
.drawer-close:hover { background: var(--accent); color: #fff; }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px;
}
.drawer-photo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.drawer-photo img {
  width: 170px;
  height: 170px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bg-alt);
  box-shadow: var(--shadow);
}

.photo-picker { margin: -4px 0 18px; }
.photo-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 7px;
  max-height: 240px;
  overflow-y: auto;
  padding: 8px;
  background: var(--white);
  border: 1px solid rgba(107, 80, 88, 0.18);
  border-radius: var(--radius-sm);
}
.photo-picker-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 7px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--t), transform var(--t);
}
.photo-picker-grid img:hover { transform: scale(1.06); }
.photo-picker-grid img.selected { border-color: var(--accent); }

.switch-field {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  margin: 4px 0 8px;
}
.switch-field input { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  width: 44px; height: 24px;
  background: rgba(107, 80, 88, 0.3);
  border-radius: var(--radius-pill);
  position: relative;
  flex-shrink: 0;
  transition: background var(--t);
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--t) var(--ease);
}
.switch-field input:checked + .switch { background: var(--ok); }
.switch-field input:checked + .switch::after { transform: translateX(20px); }
.switch-field input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }

.drawer-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid rgba(107, 80, 88, 0.12);
  background: var(--white);
}
.drawer-foot .btn-primary { flex: 1; }

/* ══════════ TOAST ══════════ */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  z-index: 200;
  box-shadow: 0 8px 30px rgba(26, 16, 18, 0.3);
  animation: toast-in 0.3s var(--ease);
  max-width: min(90vw, 480px);
  text-align: center;
}
.toast.ok    { background: var(--ok); }
.toast.error { background: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ══════════ RESPONSIVE ══════════ */
@media (max-width: 720px) {
  .topbar { padding: 10px 16px; }
  .topbar-user { display: none; }
  .toolbar { padding: 16px 16px 4px; }
  .toolbar-right { margin-left: 0; width: 100%; justify-content: space-between; }
  .grid { padding: 14px 16px 50px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .demo-banner, .import-banner { margin: 12px 16px 0; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .drawer-foot { flex-direction: column-reverse; }
}
