/* ════════════════════════════════════════════════════════════════
   PIPS by Daniela · estilos
   ════════════════════════════════════════════════════════════════ */

:root {
  --pink:       #fdbec6;
  --pink-dark:  #e8899a;
  --pink-light: #fff0f3;
  --pink-mid:   #fcd5db;
  --white:      #fff;
  --text:       #5a3a3f;
  --text-light: #a07070;
  --teal:       #7ececa;
  --shadow:     0 3px 16px rgba(253, 190, 198, 0.22);
  --shadow-lg:  0 10px 28px rgba(253, 190, 198, 0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--pink-light);
  color: var(--text);
  min-height: 100vh;
}

/* ── Layout base ──────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
}

.page-title {
  font-family: 'Pacifico', cursive;
  font-size: 2.5rem;
  color: var(--pink-dark);
  text-align: center;
  margin-bottom: 8px;
}
.page-sub {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 32px;
}

/* ── Navegación de categorías ─────────────────── */
.cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 32px;
  position: sticky;
  top: 0;
  background: var(--pink-light);
  padding: 12px 0;
  z-index: 10;
}
.cat-btn {
  background: var(--white);
  border: 1.5px solid var(--pink-mid);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.cat-btn:hover { transform: translateY(-2px); }
.cat-btn.active {
  background: var(--pink-dark);
  color: var(--white);
  border-color: var(--pink-dark);
}

/* ── Sección de grupo ─────────────────────────── */
.group-section { margin-bottom: 40px; }
.group-title {
  font-family: 'Pacifico', cursive;
  font-size: 1.6rem;
  color: var(--pink-dark);
  margin-bottom: 16px;
}

/* ── Grid de productos ────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: 14px;
}

/* ── Card de producto ─────────────────────────── */
.card {
  background: var(--white);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1.5px solid rgba(253, 190, 198, 0.28);
  transition: transform 0.25s, box-shadow 0.25s;
  cursor: pointer;
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.card-img {
  background: linear-gradient(135deg, var(--pink-light), var(--pink-mid));
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.6rem;
  position: relative;
  overflow: hidden;
}
.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

.badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 999px;
  z-index: 1;
}
.badge.warn { color: #b85c00; }

.card-body { padding: 14px; }
.card-name {
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.33;
  margin-bottom: 8px;
}
.card-price {
  font-family: 'Pacifico', cursive;
  font-size: 1.35rem;
  color: var(--pink-dark);
}
.card-note { font-size: 0.65rem; color: var(--text-light); margin-top: 2px; }

/* ── Botones genéricos ────────────────────────── */
.btn {
  background: var(--pink-dark);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}
.btn:hover { transform: translateY(-1px); opacity: 0.92; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: var(--white);
  color: var(--pink-dark);
  border: 1.5px solid var(--pink-dark);
}
.btn-danger { background: #d9534f; }
.btn-sm { padding: 6px 14px; font-size: 0.78rem; }

/* ── Estados ──────────────────────────────────── */
.loading, .empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-light);
}
.empty-emoji { font-size: 3rem; display: block; margin-bottom: 12px; }

/* ════════════════════════════════════════════════════════════════
   ADMIN
   ════════════════════════════════════════════════════════════════ */

.admin-header {
  background: var(--pink-dark);
  color: var(--white);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.admin-header h1 {
  font-family: 'Pacifico', cursive;
  font-size: 1.4rem;
  font-weight: normal;
  white-space: nowrap;
}
.admin-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.admin-actions #userEmail {
  word-break: break-all;
  max-width: 200px;
}
@media (max-width: 540px) {
  .admin-header {
    padding: 14px 16px;
    justify-content: center;
    text-align: center;
  }
  .admin-header h1 { font-size: 1.25rem; width: 100%; }
  .admin-actions { width: 100%; justify-content: space-between; }
  .admin-actions #userEmail { font-size: 0.78rem; }
}

.admin-table {
  background: var(--white);
  border-radius: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow);
  margin-top: 24px;
}
.admin-table table {
  width: 100%;
  min-width: 760px;        /* fuerza scroll horizontal en celular para que no se aplasten las columnas */
  border-collapse: collapse;
}
/* Indicador visual de que se puede deslizar (gradiente sutil en el borde derecho) */
@media (max-width: 760px) {
  .admin-table {
    position: relative;
    background-image: linear-gradient(to right, transparent calc(100% - 24px), rgba(232,137,154,0.12));
    background-attachment: local;
  }
}
.admin-table th, .admin-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--pink-mid);
  font-size: 0.85rem;
}
.admin-table th {
  background: var(--pink-light);
  font-weight: 600;
  color: var(--pink-dark);
}
.admin-table tr:hover { background: var(--pink-light); }
.admin-table .thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--pink-light);
}

/* ── Formulario ───────────────────────────────── */
.form-card {
  background: var(--white);
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--shadow);
  max-width: 600px;
  margin: 0 auto;
}
.form-card h2 {
  font-family: 'Pacifico', cursive;
  color: var(--pink-dark);
  margin-bottom: 20px;
  text-align: center;
}
.form-row { margin-bottom: 14px; }
.form-row label {
  display: block;
  font-size: 0.8rem;
  color: var(--text);
  margin-bottom: 4px;
  font-weight: 500;
}
.form-row input, .form-row textarea, .form-row select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--pink-mid);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--pink-light);
  color: var(--text);
}
.form-row input:focus, .form-row textarea:focus, .form-row select:focus {
  outline: none;
  border-color: var(--pink-dark);
  background: var(--white);
}
.form-row textarea { min-height: 80px; resize: vertical; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 8px; margin-top: 20px; }

.msg {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.88rem;
}
.msg.ok   { background: #d4edda; color: #155724; }
.msg.err  { background: #f8d7da; color: #721c24; }

/* ── Modal (ventana flotante) ─────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(90, 58, 63, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  animation: fadeIn 0.2s ease-out;
}
.modal-overlay.open { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-content {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: auto;
  animation: slideUp 0.25s ease-out;
}
.modal-content .form-card {
  max-width: none;
  margin: 0;
  padding-top: 28px;
}
.modal-close {
  position: absolute;
  top: -12px;
  right: -12px;
  z-index: 2;
  background: var(--white);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.1rem;
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.15s;
}
.modal-close:hover {
  background: var(--pink-light);
  transform: scale(1.05);
}
@media (max-width: 700px) {
  .modal-close {
    top: 6px;
    right: 6px;
  }
}
body.modal-open {
  overflow: hidden;
}

/* ── Galería de fotos del admin ───────────────── */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
  min-height: 20px;
}
.photo-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 18px;
  color: var(--text-light);
  font-size: 0.82rem;
  border: 2px dashed var(--pink-mid);
  border-radius: 12px;
  background: var(--pink-light);
}
.photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--pink-mid);
  background: var(--pink-light);
  transition: border-color 0.15s, transform 0.15s;
}
.photo-item.main {
  border-color: var(--pink-dark);
  box-shadow: 0 4px 14px rgba(232, 137, 154, 0.35);
}
.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-item-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
}
.photo-item-btn {
  background: rgba(255, 255, 255, 0.95);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.1s;
}
.photo-item-btn:hover { transform: scale(1.1); }
.photo-item-btn.star { color: #ffb400; }
.photo-item-btn.remove { color: #d9534f; }
.photo-item-main-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: var(--pink-dark);
  color: var(--white);
  font-size: 0.65rem;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 600;
}
.photo-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ── Login ────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-card {
  background: var(--white);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.login-card h1 {
  font-family: 'Pacifico', cursive;
  font-size: 1.8rem;
  color: var(--pink-dark);
  margin-bottom: 24px;
}
