@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --color-bg:         #FBF6EE;
  --color-bg-alt:     #F4EBD9;
  --color-surface:    #FFFFFF;
  --color-ink:        #2B2118;
  --color-ink-muted:  #6B5D4F;
  --color-wine:       #7A2E2E;
  --color-wine-dark:  #5E2222;
  --color-lemon:      #E3B23C;
  --color-lemon-dark: #C89526;
  --color-border:     #E7D9BE;
  --sidebar-bg:       #1C0E0E;
  --sidebar-text:     rgba(255,255,255,0.75);
  --sidebar-active:   #7A2E2E;
  --sidebar-w:        230px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --radius: 14px;
  --shadow-soft: 0 10px 30px rgba(43, 33, 24, 0.08);
  --shadow-md:   0 4px 16px rgba(43, 33, 24, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-body);
  line-height: 1.5;
}

h1, h2, h3 { font-family: var(--font-display); color: var(--color-wine-dark); margin: 0 0 8px; }
h4 { font-family: var(--font-body); color: var(--color-ink-muted); margin: 0; }
p { margin: 0; }

/* ── Layout principal ── */

.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */

.admin-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 10;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand img {
  height: 36px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

.sidebar-group {
  padding: 20px 0 4px;
}

.sidebar-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-lemon);
  padding: 0 20px 8px;
  margin: 0;
}

/* Los tabs quedan dentro del sidebar como nav vertical */
.tabs {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 12px;
  background: transparent;
}

.tab-btn {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--sidebar-text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab-btn:hover { background: rgba(255,255,255,0.07); color: #fff; }
.tab-btn.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding: 20px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-link-web {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.83rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.sidebar-link-web:hover { background: rgba(255,255,255,0.07); color: #fff; }
.sidebar-link-web svg { opacity: 0.7; flex-shrink: 0; }

/* ── Área principal ── */

.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 20px 32px;
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 1px 8px rgba(43,33,24,0.06);
}

.admin-header h1 {
  font-size: 1.35rem;
  margin: 0 0 2px;
  color: var(--color-wine-dark);
}
.admin-header p {
  color: var(--color-ink-muted);
  font-size: 0.82rem;
}

.admin-content {
  flex: 1;
}

/* ── Container del app ── */

#app.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px;
}

/* ── Cards ── */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 22px;
  margin-bottom: 20px;
}

/* ── Formularios ── */

.field-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  margin-bottom: 8px;
}
.field-row .locale-tag {
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--color-lemon-dark);
  padding-top: 10px;
  text-transform: uppercase;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
textarea,
select {
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-wine);
  box-shadow: 0 0 0 3px rgba(122,46,46,0.12);
}
textarea { resize: vertical; min-height: 44px; }

/* ── File input estilizado ── */
input[type="file"] {
  width: 100%;
  font: inherit;
  font-size: 0.86rem;
  color: var(--color-ink-muted);
  background: var(--color-bg);
  border: 2px dashed var(--color-border);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
input[type="file"]:hover {
  border-color: var(--color-wine);
  background: #f7ede0;
}
input[type="file"]::file-selector-button {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 18px;
  border: none;
  border-radius: 999px;
  background: var(--color-wine);
  color: #fff;
  cursor: pointer;
  margin-right: 14px;
  transition: background 0.15s;
}
input[type="file"]::file-selector-button:hover {
  background: var(--color-wine-dark);
}

label.small-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-ink-muted);
  display: block;
  margin-bottom: 8px;
  margin-top: 4px;
}

/* ── Botones ── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  font-size: 0.88rem;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary  { background: var(--color-wine); color: #fff; }
.btn-primary:hover { background: var(--color-wine-dark); box-shadow: var(--shadow-md); }

.btn-secondary { background: var(--color-bg-alt); color: var(--color-ink); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-border); }

.btn-danger { background: #FDE8E8; color: #B42318; }
.btn-danger:hover { background: #FBD1D1; }

.btn-sm { padding: 6px 14px; font-size: 0.80rem; }

/* ── Item cards ── */

.item-card {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
  background: var(--color-bg);
}
.item-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.item-card-header h4 {
  font-weight: 700;
  color: var(--color-ink-muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Imagen preview ── */

.imagen-preview {
  width: 140px;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  margin-top: 10px;
  box-shadow: var(--shadow-soft);
}

/* ── Section title ── */

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

/* ── Toast ── */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.88rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 300;
  max-width: 360px;
  display: none;
}
.toast.show { display: block; }
.toast.ok    { background: #DCFCE7; color: #166534; border: 1px solid #86EFAC; }
.toast.error { background: #FDE8E8; color: #B42318; border: 1px solid #F5A9A9; }

/* ── Misc ── */

.precio-input { max-width: 120px; }

.item-fields-grid {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 10px;
}

.hint {
  color: var(--color-ink-muted);
  font-size: 0.84rem;
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ── Split carta (editor + preview) ── */

.carta-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 46%);
  gap: 24px;
  align-items: start;
}
.carta-editor-col { min-width: 0; }
.carta-preview-col {
  position: sticky;
  top: 80px;
}
.carta-preview-iframe {
  width: 100%;
  height: calc(100vh - 140px);
  min-height: 480px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow-soft);
}
@media (max-width: 980px) {
  .carta-split { grid-template-columns: 1fr; }
  .carta-preview-col { position: static; }
  .carta-preview-iframe { height: 480px; }
}

/* ── Páginas de acceso (login / crear cuenta / configurar 2FA) ── */

.auth-body {
  min-height: 100vh;
  display: flex;
}
.auth-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--sidebar-bg);
  background-image: radial-gradient(circle at 20% 20%, rgba(122,46,46,0.35), transparent 55%),
                     radial-gradient(circle at 80% 80%, rgba(227,178,60,0.12), transparent 50%);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.auth-card--ancha { max-width: 440px; }
.auth-logo {
  height: 40px;
  width: auto;
  display: block;
  margin: 0 auto 18px;
  filter: brightness(0) saturate(100%) invert(14%) sepia(23%) saturate(1600%) hue-rotate(325deg) brightness(0.9);
}
.auth-card h2 { font-size: 1.15rem; margin-bottom: 6px; }
.auth-card .hint { margin-bottom: 18px; }
.auth-card form { text-align: left; }
.auth-submit { width: 100%; justify-content: center; margin-top: 6px; }
.auth-error { color: #B42318; margin-bottom: 0; margin-top: 4px; }

.qr-box {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
  text-align: center;
}
.qr-box img { width: 200px; height: 200px; display: block; margin: 0 auto 12px; border-radius: 8px; }
.qr-box .small-label { margin-bottom: 4px; }
.qr-secreto {
  display: inline-block;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 6px 10px;
  word-break: break-all;
}

/* ── Ajustes: usuarios del panel ── */

.usuarios-tabla {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}
.usuario-fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-bg);
}
.usuario-fila-info { display: flex; flex-direction: column; gap: 3px; }
.usuario-fila-nombre { font-weight: 700; }
.usuario-fila-meta { font-size: 0.78rem; color: var(--color-ink-muted); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.badge-ok { background: #DCFCE7; color: #166534; }
.badge-pendiente { background: #FEF3C7; color: #92400E; }
.usuario-fila-acciones { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}
.modal-box {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 26px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.modal-box h3 { margin-bottom: 6px; }
.modal-acciones { display: flex; gap: 10px; margin-top: 16px; }
.modal-acciones .btn { flex: 1; justify-content: center; }

/* ── Preview overlay ── */

.preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 30px;
}
.preview-box {
  background: white;
  border-radius: 14px;
  overflow: hidden;
  width: 100%;
  max-width: 900px;
  height: 85vh;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.preview-close {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 2;
}
.preview-iframe {
  border: none;
  flex: 1;
  width: 100%;
}
