/* =========================================================
   PANEL ADMIN — Conectar Pehuenco
   Mismo lenguaje visual que el sitio público, en formato utilitario
   ========================================================= */

:root {
  --plum-900: #34162f;
  --plum-800: #47203f;
  --plum-700: #6b3a63;
  --plum-500: #8f5a86;
  --lilac-300: #b79cc9;
  --lilac-200: #d8c6e0;
  --lilac-100: #eee3f0;
  --gold-600: #a67c3d;
  --gold-500: #c1954f;
  --gold-300: #dcb97e;
  --cream-100: #faf5eb;
  --cream-50: #f5f1ea;
  --ink-900: #2b1f2a;
  --ink-600: #6a5b67;
  --white: #ffffff;
  --danger: #b64545;
  --danger-bg: #fbe6e6;
  --success: #3a7a34;
  --success-bg: #e6f2e3;
  --radius-md: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 24px rgba(52,22,47,.10);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Poppins', 'Segoe UI', sans-serif;
  background: var(--cream-50);
  color: var(--ink-900);
  font-size: 14.5px;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
h1,h2,h3,h4 { font-family: 'Cormorant Garamond', Georgia, serif; margin: 0 0 6px; color: var(--plum-900); }

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

/* Sidebar */
.admin-sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--plum-900);
  color: rgba(255,255,255,.85);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.admin-sidebar .brand {
  padding: 24px 22px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.admin-sidebar .brand span { font-family: 'Playball', cursive; font-size: 1.5rem; color: var(--gold-300); }
.admin-nav { padding: 16px 12px; flex: 1; }
.admin-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px; border-radius: 10px;
  font-size: .88rem; font-weight: 500;
  color: rgba(255,255,255,.72);
  margin-bottom: 3px;
}
.admin-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.admin-nav a.active { background: var(--gold-500); color: var(--plum-900); font-weight: 600; }
.admin-nav .nav-group-title {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .1em;
  color: rgba(255,255,255,.4); padding: 16px 14px 6px;
}
.admin-sidebar .sidebar-foot {
  padding: 16px 22px; border-top: 1px solid rgba(255,255,255,.1); font-size: .8rem;
}
.admin-sidebar .sidebar-foot a { color: var(--gold-300); }

/* Main */
.admin-main { flex: 1; min-width: 0; }
.admin-topbar {
  background: var(--white); border-bottom: 1px solid rgba(0,0,0,.06);
  padding: 16px 28px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.admin-topbar h1 { font-size: 1.4rem; }
.admin-content { padding: 26px 28px 60px; max-width: 1160px; }

.topbar-user { display: flex; align-items: center; gap: 14px; font-size: .86rem; color: var(--ink-600); }
.topbar-user a { color: var(--plum-700); font-weight: 600; }

/* Cards / panels */
.panel { background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow); padding: 24px; margin-bottom: 22px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.panel-head h2 { font-size: 1.25rem; }
.panel-head p { color: var(--ink-600); font-size: .85rem; margin: 2px 0 0; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow); padding: 20px 22px; }
.stat-card .stat-label { font-size: .78rem; color: var(--ink-600); text-transform: uppercase; letter-spacing: .05em; }
.stat-card .stat-value { font-family: 'Cormorant Garamond', serif; font-size: 2.1rem; font-weight: 700; color: var(--plum-800); margin-top: 4px; }
.stat-card.accent { background: var(--plum-800); }
.stat-card.accent .stat-label { color: rgba(255,255,255,.6); }
.stat-card.accent .stat-value { color: var(--gold-300); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 20px; border-radius: 9px; font-size: .85rem; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: all .15s ease;
}
.btn-primary { background: var(--plum-700); color: #fff; }
.btn-primary:hover { background: var(--plum-800); }
.btn-gold { background: var(--gold-500); color: #fff; }
.btn-gold:hover { background: var(--gold-600); }
.btn-outline { background: transparent; border-color: var(--lilac-300); color: var(--plum-700); }
.btn-outline:hover { background: var(--lilac-100); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #f5d0d0; }
.btn-sm { padding: 6px 14px; font-size: .78rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Forms */
.field { margin-bottom: 17px; }
.field label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: 6px; color: var(--plum-800); }
.field .hint { font-size: .76rem; color: var(--ink-600); margin-top: 5px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--lilac-200); background: var(--cream-100);
  border-radius: var(--radius-sm); padding: 10px 13px; font-family: inherit; font-size: .9rem; color: var(--ink-900);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(193,149,79,.16);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .field-row, .field-row-3 { grid-template-columns: 1fr; } }
.checkbox-field { display: flex; align-items: center; gap: 9px; }
.checkbox-field input { width: auto; }
.current-image { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.current-image img { width: 70px; height: 70px; object-fit: cover; border-radius: 8px; border: 1px solid var(--lilac-200); }

/* Table */
.table-wrap { overflow-x: auto; }
table.admin-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.admin-table th {
  text-align: left; padding: 11px 14px; background: var(--cream-100);
  color: var(--plum-800); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em;
  border-bottom: 2px solid var(--lilac-200);
}
table.admin-table td { padding: 12px 14px; border-bottom: 1px solid #f0ebe3; vertical-align: middle; }
table.admin-table tr:hover td { background: var(--cream-100); }
table.admin-table img.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 7px; }
.row-actions { display: flex; gap: 8px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.badge-gold { background: rgba(193,149,79,.15); color: var(--gold-600); }
.badge-plum { background: var(--lilac-100); color: var(--plum-700); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-wait { background: #fdeecb; color: #9a6a10; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-gray { background: #eee; color: #777; }

/* Alerts */
.alert { padding: 13px 16px; border-radius: var(--radius-sm); font-size: .87rem; margin-bottom: 18px; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #bfe0b6; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #f0c2c2; }
.alert-info { background: var(--lilac-100); color: var(--plum-700); border: 1px solid var(--lilac-200); }

/* Empty state */
.empty-state { text-align: center; padding: 50px 20px; color: var(--ink-600); }
.empty-state svg { color: var(--lilac-300); margin-bottom: 10px; }

/* Login */
.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--plum-900), var(--plum-700));
  padding: 20px;
}
.login-card { background: var(--white); border-radius: 20px; padding: 40px 36px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.3); text-align: center; }
.login-card .script { font-family: 'Playball', cursive; font-size: 2.3rem; color: var(--plum-800); }
.login-card p.tag { color: var(--ink-600); font-size: .85rem; margin-top: -6px; margin-bottom: 24px; }
.login-card .field { text-align: left; }

/* Draggable order hint */
.order-hint { font-size: .76rem; color: var(--ink-600); }

/* Toggle switch small */
.toggle-inline { display: inline-flex; align-items: center; gap: 8px; font-size: .84rem; }

/* Mobile sidebar */
.topbar-toggle { display: none; background: none; border: none; color: var(--plum-800); }
@media (max-width: 900px) {
  .admin-sidebar { position: fixed; left: 0; top: 0; z-index: 200; transform: translateX(-100%); transition: transform .2s ease; }
  .admin-sidebar.open { transform: translateX(0); }
  .topbar-toggle { display: block; }
  .admin-content { padding: 20px 16px 60px; }
  .admin-topbar { padding: 14px 16px; }
}

/* =========================================================
   CALENDARIO DE TURNOS
   ========================================================= */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: #f0ebe3;
  border: 1px solid #f0ebe3;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.calendar-head-cell {
  background: var(--cream-100);
  padding: 10px 6px;
  text-align: center;
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--plum-700);
}
.calendar-cell {
  background: var(--white);
  min-height: 108px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.calendar-cell.is-outside { background: #fafaf8; }
.calendar-cell.is-today { background: rgba(193,149,79,.08); box-shadow: inset 0 0 0 2px var(--gold-500); }
.calendar-day-num { font-size: .78rem; font-weight: 600; color: var(--ink-600); }
.calendar-cell.is-today .calendar-day-num { color: var(--gold-600); font-weight: 800; }
.calendar-events { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.calendar-event {
  display: flex; flex-direction: column;
  padding: 3px 6px;
  border-radius: 6px;
  font-size: .68rem;
  line-height: 1.25;
  color: #fff;
  text-decoration: none;
}
.calendar-event-hora { font-weight: 700; opacity: .9; }
.calendar-event-nombre { font-weight: 600; }
.calendar-event-cupo { opacity: .85; }
.calendar-event.cupo-libre { background: var(--plum-700); }
.calendar-event.cupo-poco { background: var(--gold-500); }
.calendar-event.cupo-lleno { background: var(--danger); }

.calendar-legend {
  display: flex; gap: 18px; flex-wrap: wrap;
  margin-top: 16px; font-size: .78rem; color: var(--ink-600);
}
.calendar-legend span { display: flex; align-items: center; gap: 6px; }
.calendar-legend .dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.calendar-legend .cupo-libre { background: var(--plum-700); }
.calendar-legend .cupo-poco { background: var(--gold-500); }
.calendar-legend .cupo-lleno { background: var(--danger); }

@media (max-width: 700px) {
  .calendar-grid { grid-template-columns: repeat(7, minmax(0,1fr)); }
  .calendar-cell { min-height: 76px; padding: 4px; }
  .calendar-event-nombre { display: none; }
  .calendar-head-cell { font-size: .62rem; padding: 6px 2px; }
}
