/* ─────────────────────────────────────────
   Comanditas Demo — admin.css
   ───────────────────────────────────────── */

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

button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }

body {
  font-family: 'Inter', sans-serif;
  background: #0A0A0A;
  color: #E8E4DE;
  min-height: 100vh;
  transition: background 0.4s, color 0.4s;
}

/* HEADER */
.admin-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10,10,10,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: background 0.4s, border-color 0.4s;
}
.admin-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; height: 56px; max-width: 1200px; margin: 0 auto;
  position: relative;
}
.admin-header__left { display: flex; align-items: center; }
.admin-header__right { display: flex; align-items: center; gap: 0.75rem; }
.admin-link--back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  font-size: 1.1rem; line-height: 1; color: #25D366; text-decoration: none;
  background: rgba(255,255,255,0.05); transition: background 0.2s, color 0.2s;
}
.admin-link--back:hover { background: rgba(37,211,102,0.15); color: #25D366; }
.admin-reset-btn {
  font-family: 'Inter', sans-serif; font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.08em; color: rgba(232,228,222,0.5); text-transform: uppercase;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  padding: 0.25rem 0.6rem; border-radius: 6px; cursor: pointer; transition: all 0.2s;
}
.admin-reset-btn:hover { color: #25D366; border-color: #25D366; }

/* MAIN */
.admin-main { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.admin-page { display: flex; flex-direction: column; gap: 1.5rem; }

/* STATS */
.admin-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem;
}
.admin-stat {
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px; padding: 1.25rem; text-align: center;
  transition: background 0.4s, border-color 0.4s;
}
.admin-stat__value {
  font-family: 'Playfair Display', Georgia, serif; font-size: 2rem; font-weight: 700;
  color: #E8E4DE; line-height: 1;
}
.admin-stat__value--accent { color: #25D366; }
.admin-stat__label {
  font-size: 0.75rem; color: rgba(232,228,222,0.5); margin-top: 0.35rem;
  letter-spacing: 0.05em;
}

/* AI SUMMARY CARD */
.admin-card--ai {
  position: relative;
  border-color: rgba(37,211,102,0.28);
  background:
    linear-gradient(180deg, rgba(37,211,102,0.06), rgba(37,211,102,0.02)),
    rgba(255,255,255,0.02);
  overflow: hidden;
  padding: 1.6rem 1.75rem;
}
.admin-card--ai::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, #25D366, #20BA5A); border-radius: 0 3px 3px 0;
}
.admin-card__ai-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap;
}
.ai-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-family: 'Inter', sans-serif; font-size: 0.65rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: #25D366; background: rgba(37,211,102,0.12);
  padding: 0.25rem 0.6rem; border-radius: 20px;
}
.ai-badge svg { width: 13px; height: 13px; stroke: #25D366; }
.admin-card__ai-title {
  font-family: 'Playfair Display', Georgia, serif; font-size: 1.15rem; font-weight: 700;
  letter-spacing: 0.02em; margin-bottom: 1rem; color: #E8E4DE;
}
.admin-card__ai-text {
  display: flex; flex-direction: column; gap: 0.85rem;
  max-width: 780px;
}
.ai-resumen__line {
  display: flex; align-items: flex-start; gap: 0.6rem;
  font-size: 0.9rem; line-height: 1.6; color: rgba(232,228,222,0.85);
  margin: 0;
}
.ai-resumen__line strong { color: #25D366; font-weight: 600; }
.ai-resumen__line--warn strong { color: #FFB74D; }
.ai-resumen__dot {
  flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%;
  margin-top: 0.45em; background: #25D366;
  box-shadow: 0 0 0 3px rgba(37,211,102,0.15);
}
.ai-resumen__line--warn .ai-resumen__dot {
  background: #FFB74D; box-shadow: 0 0 0 3px rgba(255,183,77,0.15);
}

/* PRODUCT EDITOR (IA) */
.admin-card--editor { align-self: start; }
.editor-note {
  font-size: 0.78rem; color: rgba(232,228,222,0.55); line-height: 1.6;
  margin-bottom: 1rem;
}
.ai-field { display: block; margin-bottom: 0.9rem; }
.ai-field__label {
  display: block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em;
  color: rgba(232,228,222,0.6); margin-bottom: 0.35rem;
}
.ai-field__label-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 0.75rem; margin-bottom: 0.35rem; flex-wrap: wrap;
}
.ai-input {
  width: 100%; padding: 0.6rem 0.75rem;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px; color: #E8E4DE; font-family: 'Inter', sans-serif;
  font-size: 0.85rem; transition: border-color 0.2s, box-shadow 0.2s;
}
.ai-input::placeholder { color: rgba(232,228,222,0.3); }
.ai-input:focus { outline: none; border-color: #25D366; box-shadow: 0 0 0 3px rgba(37,211,102,0.12); }
.ai-textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.ai-gen-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.9rem; font-family: 'Inter', sans-serif;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em;
  color: #fff; background: linear-gradient(135deg, #25D366, #1EBE5A);
  border-radius: 50px; cursor: pointer; transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
}
.ai-gen-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.ai-gen-btn svg { width: 15px; height: 15px; stroke: #fff; flex-shrink: 0; }
.ai-gen-btn:disabled { opacity: 0.6; cursor: wait; transform: none; }
.ai-gen-btn--loading svg { animation: ai-spin 0.9s linear infinite; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-gen-error {
  margin: 0 0 0.75rem; font-size: 0.78rem; color: #E53935;
  background: rgba(229,57,53,0.1); border: 1px solid rgba(229,57,53,0.25);
  padding: 0.5rem 0.75rem; border-radius: 8px;
}

/* GRID */
.admin-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem;
}

/* CARD */
.admin-card {
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px; overflow: hidden; transition: background 0.4s, border-color 0.4s;
}
.admin-card__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.admin-card__title {
  font-family: 'Playfair Display', Georgia, serif; font-size: 0.95rem; font-weight: 600;
  letter-spacing: 0.03em;
}
.admin-card__tag {
  font-size: 0.65rem; color: rgba(232,228,222,0.4); letter-spacing: 0.05em;
}
.admin-card__body { padding: 1.25rem; }

/* CHARTS */
.admin-charts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem;
}
.chart-box { height: 240px; position: relative; }
.admin-card--alert {
  grid-column: 1 / -1;
  border-color: rgba(255,140,66,0.25);
}
.admin-card__tag--alert {
  color: #FF8C42; background: rgba(255,140,66,0.12);
  padding: 0.15rem 0.5rem; border-radius: 4px;
}
.sinventas-list { display: flex; flex-direction: column; gap: 0.4rem; }
.sinventas-item {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.6rem 0.9rem; background: rgba(255,140,66,0.05);
  border: 1px solid rgba(255,140,66,0.15); border-radius: 8px;
}
.sinventas-item__name { font-size: 0.85rem; font-weight: 500; }
.sinventas-item__cat { font-size: 0.7rem; color: rgba(232,228,222,0.4); }
.sinventas-item__tag {
  font-family: 'Inter', sans-serif; font-size: 0.6rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: #FF8C42;
  background: rgba(255,140,66,0.12); padding: 0.15rem 0.5rem; border-radius: 4px;
  white-space: nowrap;
}

/* ORDER TABLE */
.order-table { display: flex; flex-direction: column; gap: 0.5rem; }
.order-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04); border-radius: 8px;
  transition: background 0.4s, border-color 0.4s;
}
.order-row__left { display: flex; flex-direction: column; gap: 0.15rem; }
.order-row__name { font-weight: 600; font-size: 0.9rem; }
.order-row__detail { font-size: 0.75rem; color: rgba(232,228,222,0.5); }
.order-row__right { display: flex; flex-direction: column; align-items: flex-end; gap: 0.15rem; }
.order-row__total { font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 0.9rem; color: #25D366; }
.order-row__time { font-size: 0.7rem; color: rgba(232,228,222,0.4); }
.order-row__badge {
  font-family: 'Inter', sans-serif; font-size: 0.6rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; padding: 0.15rem 0.4rem;
  border-radius: 4px;
}
.order-row__badge--new { background: rgba(37,211,102,0.15); color: #25D366; }
.order-row__badge--preparing { background: rgba(255,213,79,0.15); color: #FFD54F; }

/* MENU LIST */
.menu-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.65rem 0; border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: opacity 0.2s;
}
.menu-item:last-child { border-bottom: none; }
.menu-item--agotado { opacity: 0.5; }
.menu-item--agotado .toggle input:not(:checked) + .toggle__track { background: rgba(229,57,53,0.3); }
.menu-item__agotado-tag {
  font-family: 'Inter', sans-serif; font-size: 0.6rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: #E53935; background: rgba(229,57,53,0.12); padding: 0.1rem 0.4rem; border-radius: 4px; margin-left: 0.4rem;
}
.menu-item__left { display: flex; align-items: center; gap: 0.75rem; }
.menu-item__img {
  width: 40px; height: 40px; border-radius: 8px; object-fit: cover;
  background: rgba(255,255,255,0.04);
}
.menu-item__name { font-size: 0.85rem; font-weight: 500; }
.menu-item__cat { font-size: 0.7rem; color: rgba(232,228,222,0.4); }
.menu-item__right { display: flex; align-items: center; gap: 0.75rem; }
.menu-item__price {
  font-family: 'Playfair Display', Georgia, serif; font-size: 0.85rem; font-weight: 600; color: #25D366;
}

/* TOGGLE */
.toggle {
  position: relative; width: 36px; height: 20px; cursor: pointer;
}
.toggle input { display: none; }
.toggle__track {
  position: absolute; inset: 0; background: rgba(255,255,255,0.1);
  border-radius: 10px; transition: background 0.2s;
}
.toggle input:checked + .toggle__track { background: #25D366; }
.toggle__knob {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  background: #fff; border-radius: 50%; transition: transform 0.2s;
}
.toggle input:checked ~ .toggle__knob { transform: translateX(16px); }

.admin-note {
  font-size: 0.75rem; color: rgba(232,228,222,0.3); margin-top: 1rem;
  font-style: italic; text-align: center;
}

/* CONTACT FAB (CTA a WhatsApp del dev) */
.contact-fab {
  position: fixed; left: 1.5rem; bottom: 1.5rem; z-index: 100;
  display: inline-flex; align-items: center; gap: 0.55rem;
  padding: 0.8rem 1.3rem;
  background: linear-gradient(135deg, #25D366, #1EBE5A);
  color: #fff; font-family: 'Inter', sans-serif; font-size: 0.85rem; font-weight: 700;
  border-radius: 50px; box-shadow: 0 6px 24px rgba(0,0,0,0.45);
  transition: transform 0.2s, box-shadow 0.2s;
}
.contact-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,0.55); }
.contact-fab svg { width: 18px; height: 18px; stroke: #fff; flex-shrink: 0; }
.contact-fab span { white-space: nowrap; }

/* THEME FAB */
.theme-fab {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 100;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  cursor: pointer; transition: border-color 0.2s, transform 0.2s;
}
.theme-fab:hover { border-color: #25D366; transform: scale(1.1); }
.theme-fab svg { width: 18px; height: 18px; stroke: #25D366; }

/* THEME PANEL */
.theme-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 900; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.theme-overlay.open { opacity: 1; pointer-events: auto; }
.theme-panel { position: fixed; bottom: 0; left: 0; right: 0; background: #1A1A1A; border-top: 1px solid rgba(255,255,255,0.08); border-radius: 20px 20px 0 0; padding: 1.5rem 1.25rem 2rem; z-index: 950; transform: translateY(100%); transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.3, 1), background 0.4s; }
.theme-panel.open { transform: translateY(0); }
.theme-panel__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.theme-panel__title { font-family: 'Playfair Display', Georgia, serif; font-size: 1rem; font-weight: 600; letter-spacing: 0.03em; }
.theme-panel__close { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; font-size: 1rem; color: rgba(232,228,222,0.5); border-radius: 8px; transition: background 0.2s; }
.theme-panel__close:hover { background: rgba(255,255,255,0.06); }
.theme-panel__note { font-size: 0.8rem; color: rgba(232,228,222,0.4); margin-bottom: 1.25rem; font-style: italic; }
.theme-options { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.5rem; }
.theme-option { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; padding: 0.6rem 0.2rem; border-radius: 12px; border: 2px solid transparent; transition: border-color 0.2s, background 0.2s; }
.theme-option:hover { background: rgba(255,255,255,0.04); }
.theme-option.active { border-color: #25D366; background: rgba(255,255,255,0.04); }
.theme-swatch { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.theme-name { font-size: 0.65rem; font-weight: 500; letter-spacing: 0.05em; color: rgba(232,228,222,0.5); }
.theme-option.active .theme-name { color: #E8E4DE; }

/* RESPONSIVE */
@media (max-width: 700px) {
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-charts { grid-template-columns: 1fr; }
  .admin-main { padding: 1rem; }
}
@media (max-width: 480px) {
  .admin-header__inner { padding: 0 1rem; }
  .admin-stat__value { font-size: 1.5rem; }
  .contact-fab { left: 0.75rem; padding: 0.7rem 1.1rem; font-size: 0.8rem; }
}