/* ============================================================
   ZOE VEOS — Panel Administrativo CSS
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --rose:        #E8A4A4;
  --rose-dark:   #C97070;
  --rose-light:  #F5D5D5;
  --cream:       #FDF6EE;
  --cream-dark:  #F0E4D4;
  --gold:        #C9A96E;
  --terra:       #C4856A;
  --white:       #FFFCF9;
  --brown:       #6B4C3B;
  --brown-light: #A07060;
  --text:        #3D2B1F;
  --text-light:  #7A5C4E;
  --text-muted:  #B09080;
  --border:      #EDD9CC;
  --shadow:      rgba(100,50,30,0.1);
  --shadow-md:   rgba(100,50,30,0.18);

  --sidebar-w: 260px;
  --font-display: 'Cormorant Garamond', serif;
  --font-body:    'DM Sans', sans-serif;
  --transition: 0.3s cubic-bezier(0.4,0,0.2,1);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font-body);
  background: #f7f0ea;
  color: var(--text);
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: var(--font-body); }
img { max-width: 100%; }
input, textarea, select { font-family: var(--font-body); font-size: 0.9rem; }
ul { list-style: none; }

/* ============================================================
   LOGIN
   ============================================================ */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--cream-dark), var(--rose-light));
  padding: 20px;
}
.login-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px var(--shadow-md);
  text-align: center;
}
.login-logo {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 400;
  color: var(--brown);
  letter-spacing: 0.2em;
  margin-bottom: 8px;
}
.login-sub {
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 36px;
}
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-input {
  width: 100%;
  padding: 14px 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--cream);
  outline: none;
  transition: var(--transition);
  text-align: left;
}
.login-input:focus { border-color: var(--rose); background: var(--white); }
.login-btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-full);
  background: var(--brown);
  color: white;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: var(--transition);
  margin-top: 6px;
}
.login-btn:hover { background: var(--rose-dark); }
.login-error {
  font-size: 0.82rem;
  color: #c62828;
  background: #fce4ec;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  display: none;
}
.login-error.show { display: block; }

/* ============================================================
   LAYOUT
   ============================================================ */
#admin-app { display: none; min-height: 100vh; }
#admin-app.show { display: flex; }

/* SIDEBAR */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--brown);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: var(--transition);
  overflow-y: auto;
}
.sidebar-logo {
  padding: 28px 24px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo-text {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: white;
  letter-spacing: 0.2em;
  display: block;
}
.sidebar-logo-sub {
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  margin-top: 4px;
}

.sidebar-nav { padding: 16px 0; flex: 1; }
.nav-group { margin-bottom: 8px; }
.nav-group-label {
  font-size: 0.62rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 10px 24px 6px;
}

/* DROPDOWN NAV */
.nav-item { position: relative; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 24px;
  color: rgba(255,255,255,0.7);
  font-size: 0.88rem;
  font-weight: 400;
  transition: var(--transition);
  cursor: pointer;
  justify-content: space-between;
  user-select: none;
}
.nav-link-left { display: flex; align-items: center; gap: 12px; }
.nav-link:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-link.active { background: rgba(255,255,255,0.12); color: white; }
.nav-link .nav-icon { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; }
.nav-arrow {
  font-size: 0.7rem;
  transition: transform 0.3s ease;
  margin-left: auto;
}
.nav-item.open .nav-arrow { transform: rotate(90deg); }

.nav-dropdown {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
  background: rgba(0,0,0,0.15);
}
.nav-item.open .nav-dropdown { max-height: 400px; }
.nav-dropdown a {
  display: block;
  padding: 9px 24px 9px 54px;
  color: rgba(255,255,255,0.55);
  font-size: 0.83rem;
  transition: var(--transition);
}
.nav-dropdown a:hover, .nav-dropdown a.active-sub {
  color: var(--rose-light);
  background: rgba(255,255,255,0.05);
}

.sidebar-user {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--rose);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  color: white;
  font-weight: 600;
}
.sidebar-user-name { font-size: 0.82rem; color: rgba(255,255,255,0.7); }
.sidebar-logout {
  margin-left: auto;
  font-size: 1rem;
  color: rgba(255,255,255,0.4);
  transition: var(--transition);
  padding: 6px;
}
.sidebar-logout:hover { color: var(--rose); }

/* MAIN CONTENT */
#main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* TOP BAR */
.topbar {
  background: var(--white);
  padding: 0 32px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px var(--shadow);
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--brown);
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: var(--transition);
}
.btn-main {
  background: var(--brown);
  color: white;
}
.btn-main:hover { background: var(--rose-dark); }
.btn-outline {
  border: 1.5px solid var(--border);
  color: var(--text-light);
  background: transparent;
}
.btn-outline:hover { border-color: var(--rose); color: var(--rose-dark); }
.btn-danger { background: #c62828; color: white; }
.btn-danger:hover { background: #a52020; }
.btn-success { background: #2e7d32; color: white; }
.btn-success:hover { background: #1b5e20; }

/* SECTIONS */
.admin-section {
  display: none;
  padding: 32px;
  flex: 1;
}
.admin-section.active { display: block; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 24px;
  border: 1.5px solid var(--border);
  transition: var(--transition);
}
.stat-card:hover { box-shadow: 0 8px 24px var(--shadow); transform: translateY(-2px); }
.stat-label {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.stat-label .stat-icon { font-size: 1rem; }
.stat-value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 400;
  color: var(--brown);
  margin-bottom: 6px;
}
.stat-trend {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.stat-trend.up { color: #2e7d32; }

/* ============================================================
   TABLAS
   ============================================================ */
.table-card {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  overflow: hidden;
}
.table-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.table-card-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--brown);
}
.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-input-wrap .search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.table-search {
  padding: 9px 14px 9px 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  color: var(--text);
  background: var(--cream);
  outline: none;
  transition: var(--transition);
  width: 220px;
}
.table-search:focus { border-color: var(--rose); background: var(--white); width: 260px; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 12px 20px;
  text-align: left;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: #fdf3ec;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 14px 20px;
  border-bottom: 1px solid #f5e8de;
  font-size: 0.88rem;
  color: var(--text-light);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fdf6ee; }
.data-table td img {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--cream-dark);
}
.table-actions { display: flex; gap: 8px; }
.tbl-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  transition: var(--transition);
}
.tbl-edit { background: var(--cream); color: var(--brown); }
.tbl-edit:hover { background: var(--cream-dark); }
.tbl-delete { background: #fce4ec; color: #c62828; }
.tbl-delete:hover { background: #f48fb1; }
.tbl-view { background: var(--rose-light); color: var(--rose-dark); }
.tbl-view:hover { background: var(--rose); color: white; }

/* BADGES */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.badge-rose { background: var(--rose-light); color: var(--rose-dark); }
.badge-terra { background: #f5e0d8; color: var(--terra); }
.badge-gold { background: #fdf0dc; color: #8b6914; }
.badge-green { background: #e8f5e9; color: #2e7d32; }
.badge-gray { background: var(--cream-dark); color: var(--text-muted); }

/* PAGINATION */
.table-pagination {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 10px;
}
.pagination-btns { display: flex; gap: 6px; }
.page-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-light);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.page-btn.active, .page-btn:hover {
  background: var(--rose-light);
  border-color: var(--rose);
  color: var(--rose-dark);
}

/* ============================================================
   MODALES / FORMS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(60,25,10,0.45);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(60,25,10,0.25);
  transform: translateY(20px);
  transition: 0.4s cubic-bezier(0.4,0,0.2,1);
}
.modal-overlay.open .modal-box { transform: translateY(0); }
.modal-header {
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--brown);
}
.modal-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--cream);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  color: var(--text-muted);
  transition: var(--transition);
}
.modal-close:hover { background: var(--rose-light); color: var(--rose-dark); }
.modal-body { padding: 28px; }
.modal-footer {
  padding: 20px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* FORM FIELDS */
.field-group {
  margin-bottom: 18px;
}
.field-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 7px;
}
.field-input,
.field-select,
.field-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--cream);
  outline: none;
  transition: var(--transition);
}
.field-input:focus,
.field-select:focus,
.field-textarea:focus {
  border-color: var(--rose);
  background: var(--white);
}
.field-textarea { min-height: 100px; resize: vertical; line-height: 1.6; }
.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 5px;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.field-row.thirds { grid-template-columns: 1fr 1fr 1fr; }

/* TOGGLE */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.toggle {
  position: relative;
  width: 44px; height: 24px;
  cursor: pointer;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--cream-dark);
  border-radius: 12px;
  transition: var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: white;
  top: 3px; left: 3px;
  transition: var(--transition);
  box-shadow: 0 2px 6px var(--shadow);
}
.toggle input:checked + .toggle-slider { background: var(--rose); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-label { font-size: 0.88rem; color: var(--text-light); }

/* IMAGE UPLOAD */
.img-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--cream);
  position: relative;
}
.img-upload-zone:hover, .img-upload-zone.dragover {
  border-color: var(--rose);
  background: var(--rose-light);
}
.img-upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.img-upload-icon { font-size: 2rem; color: var(--text-muted); margin-bottom: 10px; }
.img-upload-text { font-size: 0.88rem; color: var(--text-muted); }
.img-upload-text strong { color: var(--rose-dark); }
.img-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.img-preview-item {
  position: relative;
  width: 80px; height: 80px;
}
.img-preview-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
}
.img-preview-remove {
  position: absolute;
  top: -6px; right: -6px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #c62828;
  color: white;
  font-size: 0.7rem;
  display: flex; align-items: center; justify-content: center;
}

/* ============================================================
   PROMOS & CUPONES
   ============================================================ */
.promo-card, .cupon-card {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  transition: var(--transition);
  margin-bottom: 12px;
}
.promo-card:hover, .cupon-card:hover { box-shadow: 0 6px 20px var(--shadow); }
.promo-card-info, .cupon-card-info { flex: 1; min-width: 0; }
.promo-card-name, .cupon-card-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--brown);
  margin-bottom: 4px;
}
.promo-card-detail, .cupon-card-detail {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.promo-card-actions { display: flex; gap: 8px; align-items: center; }

/* ============================================================
   FRETE CONFIGURACION
   ============================================================ */
.config-card {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  padding: 28px;
  margin-bottom: 20px;
}
.config-card-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--brown);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.config-card-title .icon { font-size: 1.1rem; }

/* ============================================================
   BLOG EDITOR
   ============================================================ */
.blog-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: #fdf3ec;
}
.editor-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-light);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.editor-btn:hover { background: var(--rose-light); color: var(--rose-dark); }
.blog-editor-content {
  min-height: 280px;
  padding: 16px;
  border: 1.5px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  outline: none;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--white);
}
.seo-fields {
  background: #fdf3ec;
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1.5px solid var(--border);
}
.seo-fields-title {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================
   SLIDES MANAGER
   ============================================================ */
.slides-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.slide-item {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1.5px solid var(--border);
  transition: var(--transition);
  background: var(--white);
}
.slide-item:hover { box-shadow: 0 8px 24px var(--shadow); }
.slide-img-wrap {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--cream-dark);
  position: relative;
}
.slide-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.slide-order-badge {
  position: absolute;
  top: 10px; left: 10px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--brown);
  color: white;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.slide-info { padding: 14px; }
.slide-title { font-weight: 600; font-size: 0.9rem; color: var(--brown); margin-bottom: 4px; }
.slide-subtitle { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 10px; }
.slide-actions { display: flex; gap: 8px; }

/* ============================================================
   TOAST ADMIN
   ============================================================ */
#admin-toast {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.a-toast {
  background: var(--brown);
  color: white;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  box-shadow: 0 8px 24px var(--shadow-md);
  animation: toastIn 0.4s ease;
  pointer-events: all;
  display: flex; align-items: center; gap: 10px;
  min-width: 260px;
}
.a-toast.ok { background: #2e7d32; }
.a-toast.err { background: #c62828; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   RESPONSIVE ADMIN
   ============================================================ */
@media (max-width: 1024px) {
  :root { --sidebar-w: 220px; }
}
@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
    z-index: 200;
  }
  #sidebar.open { transform: translateX(0); }
  #main-content { margin-left: 0; }
  .admin-section { padding: 20px; }
  .topbar { padding: 0 20px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .field-row.thirds { grid-template-columns: 1fr; }
  .data-table { font-size: 0.82rem; }
}
