/* ============================================================
   Casa Rosa – admin.css
   Panel de administración
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --pink:       #e8a0b4;
  --pink-dark:  #c0637d;
  --pink-light: #fce4ec;
  --gold:       #c9a84c;
  --cream:      #fdf6f0;
  --text:       #3a2020;
  --text-light: #7a5a5a;
  --white:      #ffffff;
  --danger:     #e05252;
  --success:    #2ecc71;
  --sidebar-w:  240px;
  --font:       'Lato', 'Helvetica Neue', Arial, sans-serif;
}

body {
  font-family: var(--font);
  background: #f4f4f6;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a   { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select {
  font-family: inherit;
  font-size: 0.9rem;
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  background: var(--white);
  color: var(--text);
  transition: border-color 0.18s ease;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--pink); }
textarea { resize: vertical; min-height: 90px; }

/* ── LOGIN ───────────────────────────────────────────────────── */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--pink-light) 0%, var(--cream) 100%);
  padding: 1rem;
}

.login-card {
  background: var(--white);
  border-radius: 18px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 12px 40px rgba(192, 99, 125, 0.15);
  text-align: center;
}

.login-logo {
  height: 80px;
  width: auto;
  margin: 0 auto 1.5rem;
}

.login-card h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.login-card p {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

.login-card label {
  display: block;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 0.3rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.login-card input {
  margin-bottom: 1.2rem;
}

#login-error {
  color: var(--danger);
  font-size: 0.82rem;
  margin-bottom: 0.8rem;
  min-height: 1.2em;
}

/* ── BOTONES ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.3rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  border: none;
  transition: all 0.18s ease;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary { background: var(--pink-dark); color: var(--white); }
.btn-primary:hover { background: #a84f68; transform: translateY(-1px); }

.btn-secondary { background: #eee; color: var(--text); }
.btn-secondary:hover { background: #e0e0e0; }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #c0392b; }

.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #27ae60; }

.btn-icon {
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  background: transparent;
  border: 1.5px solid #ddd;
  color: var(--text-light);
  transition: all 0.15s ease;
}
.btn-icon:hover { border-color: var(--pink); color: var(--pink-dark); }
.btn-icon.danger:hover { border-color: var(--danger); color: var(--danger); }

.btn-full { width: 100%; justify-content: center; }

/* ── DASHBOARD LAYOUT ────────────────────────────────────────── */
[hidden] { display: none !important; }

#dashboard {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.admin-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid rgba(232, 160, 180, 0.25);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 100;
  transition: transform 0.28s ease;
}

.sidebar-logo {
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid rgba(232, 160, 180, 0.2);
  text-align: center;
}

.sidebar-logo img {
  height: 52px;
  width: auto;
  margin: 0 auto;
}

.sidebar-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pink-dark);
  margin-top: 0.4rem;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
  overflow-y: auto;
}

.sidebar-nav button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: transparent;
  border: none;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-light);
  text-align: left;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
}

.sidebar-nav button:hover {
  background: var(--pink-light);
  color: var(--pink-dark);
}

.sidebar-nav button.active {
  background: var(--pink-light);
  color: var(--pink-dark);
  border-left-color: var(--pink-dark);
}

.nav-icon { font-size: 1rem; }

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(232, 160, 180, 0.2);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-footer a {
  display: block;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-light);
  padding: 0.4rem;
  border-radius: 6px;
  transition: background 0.15s;
}
.sidebar-footer a:hover { background: var(--pink-light); color: var(--pink-dark); }

/* ── MAIN CONTENT ────────────────────────────────────────────── */
.admin-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 2rem;
  min-height: 100vh;
}

.admin-section { display: none; }
.admin-section.active { display: block; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.section-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

/* ── TARJETAS / PANELS ───────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  margin-bottom: 1rem;
}

/* ── PRODUCTOS: TABLA ────────────────────────────────────────── */
.product-table {
  width: 100%;
  border-collapse: collapse;
}

.product-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-light);
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid #f0f0f0;
}

.product-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #f5f5f5;
  font-size: 0.88rem;
  vertical-align: middle;
}

.product-table tr:hover td { background: #fafafa; }

.product-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #eee;
}

.product-thumb-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: var(--pink-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.category-badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: capitalize;
}
.cat-ramos      { background: #fff3e0; color: #e65100; }
.cat-corazones  { background: #fce4ec; color: #c0637d; }
.cat-ramilletes { background: #f3e5f5; color: #7b1fa2; }
.cat-especiales { background: #fff8e1; color: #f57f17; }

.actions-cell { display: flex; gap: 0.4rem; align-items: center; }

/* ── FORMULARIO DE PRODUCTO ──────────────────────────────────── */
.product-form-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.product-form-overlay[hidden] { display: none; }

.product-form-card {
  background: var(--white);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 1.75rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.form-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text);
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 0.35rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Imagen upload */
.image-upload-area {
  border: 2px dashed #ddd;
  border-radius: 10px;
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
  position: relative;
}

.image-upload-area:hover { border-color: var(--pink); background: var(--pink-light); }

.image-upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-preview {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  display: none;
}

.upload-icon { font-size: 1.8rem; margin-bottom: 0.3rem; }
.upload-text { font-size: 0.82rem; color: var(--text-light); }

/* Toggle variantes */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.toggle {
  position: relative;
  width: 42px;
  height: 24px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle input:checked + .toggle-slider { background: var(--pink-dark); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

.variants-fields { display: none; }
.variants-fields.visible { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  border-top: 1px solid #f0f0f0;
  padding-top: 1.25rem;
}

/* ── CONTACTO ────────────────────────────────────────────────── */
.contact-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ── FAQ ─────────────────────────────────────────────────────── */
.faq-admin-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.faq-admin-item {
  background: var(--white);
  border: 1.5px solid #eee;
  border-radius: 10px;
  padding: 1rem 1.1rem;
  transition: border-color 0.15s;
}

.faq-admin-item:hover { border-color: var(--pink); }

.faq-admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
}

.faq-admin-question {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
  flex: 1;
}

.faq-admin-controls {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

.faq-admin-answer {
  display: none;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f0f0f0;
}

.faq-admin-item.expanded .faq-admin-answer { display: block; }

.faq-admin-answer textarea { min-height: 80px; }
.faq-admin-answer input { margin-bottom: 0.5rem; }
.faq-save-row { text-align: right; margin-top: 0.5rem; }

/* ── UBICACIÓN ───────────────────────────────────────────────── */
.map-preview {
  width: 100%;
  height: 300px;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid #eee;
  margin-top: 1rem;
}

.map-preview iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ── TOAST ───────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  padding: 0.85rem 1.4rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--white);
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

#toast.success { background: var(--success); }
#toast.error   { background: var(--danger);  }

/* ── CONFIRM DIALOG ──────────────────────────────────────────── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.confirm-overlay[hidden] { display: none; }

.confirm-card {
  background: var(--white);
  border-radius: 14px;
  padding: 1.75rem;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
}

.confirm-card p {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.confirm-actions { display: flex; gap: 0.75rem; justify-content: center; }

/* ── MOBILE HAMBURGER ────────────────────────────────────────── */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 200;
  background: var(--white);
  border: 1.5px solid #eee;
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-main {
    margin-left: 0;
    padding: 1rem;
    padding-top: 4rem;
  }
  .sidebar-toggle { display: flex; align-items: center; }
  .contact-form-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .product-table th:nth-child(3),
  .product-table td:nth-child(3) { display: none; }
}
