/* ==========================================================
   RCR Barber Shop · Admin Panel
   Diseñado por GABAN Solutions — https://gabansolutions.ca
   ========================================================== */

:root {
  --gold: #D4BA67;
  --gold-light: #F1DC9B;
  --gold-bright: #FFE89A;
  --gold-deep: #A8893A;
  --bg-0: #050505;
  --bg-1: #0B0B0B;
  --bg-2: #141414;
  --bg-3: #1B1B1B;
  --bg-4: #232323;
  --text: #F5F1E6;
  --text-muted: #B8B0A0;
  --text-faint: #8A8275;
  --border: rgba(212, 186, 103, 0.22);
  --border-strong: rgba(212, 186, 103, 0.45);
  --danger: #E04848;
  --success: #2BD66A;
  --easing: cubic-bezier(.2, .7, .2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
/* `.login-screen { display:flex }` otherwise overrides the UA [hidden] rule — login stays visible after auth */
[hidden] {
  display: none !important;
}
html, body { min-height: 100%; background: var(--bg-0); color: var(--text); }
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(212,186,103,0.07), transparent 60%),
    linear-gradient(180deg, #050505, #0E0E0E 50%, #050505);
  background-attachment: fixed;
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, rgba(24,24,24,0.85), rgba(10,10,10,0.95));
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px 26px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,0.65);
}
.login-logo { width: 90px; height: 90px; border-radius: 50%; object-fit: contain; margin-bottom: 14px; }
.login-title {
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  color: var(--gold-light);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.login-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  margin-top: 4px;
  margin-bottom: 28px;
}
.login-form { text-align: left; display: flex; flex-direction: column; gap: 14px; }
.login-error {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(224, 72, 72, 0.12);
  border: 1px solid rgba(224, 72, 72, 0.4);
  color: #F5C5C5;
  font-size: 0.85rem;
  text-align: center;
}
.login-hint {
  margin-top: 22px;
  font-size: 0.74rem;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}
.login-hint a { color: var(--gold); text-decoration: none; }
.login-hint a:hover { color: var(--gold-light); text-decoration: underline; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  max-width: 920px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: linear-gradient(180deg, rgba(24,24,24,0.85), rgba(10,10,10,0.85));
  border: 1px solid var(--border);
  border-radius: 18px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-logo { width: 44px; height: 44px; border-radius: 50%; object-fit: contain; }
.topbar-title {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  color: var(--gold-light);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.topbar-sub { font-size: 0.78rem; color: var(--text-muted); }
.topbar-right { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  background: rgba(20,20,20,0.7);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 18px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.tab {
  flex: 1;
  min-width: max-content;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 9px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.18s var(--easing);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.01em;
}
.tab:hover { color: var(--text); background: rgba(212,186,103,0.05); }
.tab.is-active {
  color: #1A1407;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  border-color: var(--gold);
  font-weight: 600;
}

/* ============================================================
   SAVE BAR
   ============================================================ */
.save-bar {
  position: sticky;
  top: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(212,186,103,0.18), rgba(212,186,103,0.08));
  border: 1px solid var(--gold);
  border-radius: 14px;
  margin-bottom: 16px;
  box-shadow: 0 14px 28px rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  flex-wrap: wrap;
}
.save-bar-text { color: var(--gold-light); font-weight: 600; font-size: 0.9rem; }
.save-bar-actions { display: flex; gap: 8px; }

/* ============================================================
   PANELS
   ============================================================ */
.panel {
  background: linear-gradient(180deg, rgba(20,20,20,0.7), rgba(10,10,10,0.8));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.panel-title {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  color: var(--gold-light);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.panel-help {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.5;
}
.panel-help i { color: var(--gold); }

/* ============================================================
   FIELDS
   ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.req { color: var(--danger); }
.field-hint {
  font-size: 0.72rem;
  color: var(--text-faint);
}
.field input,
.field select,
.field textarea {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.18s var(--easing), background 0.18s var(--easing), box-shadow 0.18s var(--easing);
}
.field textarea { resize: vertical; min-height: 60px; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--gold);
  background: rgba(212,186,103,0.06);
  box-shadow: 0 0 0 3px rgba(212,186,103,0.18);
}
.field input::placeholder { color: var(--text-faint); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: all 0.18s var(--easing);
  white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #1A1407;
}
.btn-primary:hover:not([disabled]) {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(212,186,103,0.35);
}
.btn-ghost {
  background: rgba(255,255,255,0.03);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--gold); background: rgba(212,186,103,0.08); }
.btn-danger {
  background: rgba(224,72,72,0.1);
  border-color: rgba(224,72,72,0.4);
  color: #F5C5C5;
}
.btn-danger:hover { background: rgba(224,72,72,0.2); border-color: var(--danger); }
.btn-block { width: 100%; justify-content: center; padding: 11px 14px; }

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 34px; height: 34px;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s var(--easing);
}
.icon-btn:hover { color: var(--gold); border-color: var(--gold); background: rgba(212,186,103,0.08); }
.icon-btn-danger:hover { color: var(--danger); border-color: var(--danger); background: rgba(224,72,72,0.08); }

/* ============================================================
   SERVICE ROWS
   ============================================================ */
.services-list, .gallery-list, .hours-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.service-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.18s var(--easing), background 0.18s var(--easing), transform 0.18s var(--easing);
}
.service-row.is-inactive { opacity: 0.55; }
.service-row.dragging { opacity: 0.5; }
.service-row.drop-target { border-color: var(--gold); background: rgba(212,186,103,0.08); }
.service-row:hover { border-color: var(--border-strong); }
.service-row-name {
  font-family: 'Cinzel', serif;
  font-size: 0.98rem;
  color: var(--text);
  letter-spacing: 0.03em;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.service-row-desc {
  margin-top: 3px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.service-row-note {
  margin-top: 4px;
  font-size: 0.74rem;
  color: var(--gold-light);
  font-style: italic;
}
.service-row-note i { color: var(--gold); margin-right: 4px; }
.service-row-price {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding: 4px 10px;
  border: 1px solid rgba(212,186,103,0.3);
  border-radius: 999px;
}
.grip {
  cursor: grab;
  color: var(--text-faint);
  padding: 4px;
}
.grip:active { cursor: grabbing; }
.chip {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
}
.chip-off {
  background: rgba(224,72,72,0.15);
  color: #F5C5C5;
  border: 1px solid rgba(224,72,72,0.4);
}

/* ============================================================
   GALLERY ROWS
   ============================================================ */
.gallery-row {
  display: grid;
  grid-template-columns: auto 80px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.gallery-row.dragging { opacity: 0.5; }
.gallery-row.drop-target { border-color: var(--gold); background: rgba(212,186,103,0.08); }
.gallery-thumb {
  width: 80px; height: 80px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-alt {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 11px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.86rem;
  outline: none;
  transition: border-color 0.18s var(--easing);
}
.gallery-alt:focus { border-color: var(--gold); }
.empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-faint);
  font-size: 0.92rem;
  background: rgba(255,255,255,0.02);
  border: 1px dashed var(--border);
  border-radius: 12px;
}
.empty i { font-size: 1.5rem; display: block; margin-bottom: 8px; color: var(--gold); }
.upload-progress {
  padding: 10px 14px;
  background: rgba(212,186,103,0.08);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 0.86rem;
  color: var(--gold-light);
}

/* ============================================================
   HOURS ROWS
   ============================================================ */
.hours-list .hours-row {
  display: grid;
  grid-template-columns: 1.2fr auto 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.hours-list .hours-row.is-closed input[type="time"] { opacity: 0.4; }
.hours-list .hours-day {
  font-family: 'Cinzel', serif;
  font-size: 0.92rem;
  color: var(--gold-light);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.hours-list .dash { color: var(--text-faint); }
.hours-list input[type="time"] {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  color-scheme: dark;
}
.hours-list input[type="time"]:focus {
  border-color: var(--gold);
  outline: none;
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--text-muted);
  cursor: pointer;
}
.check input { accent-color: var(--gold); }

/* ============================================================
   MODAL
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
  animation: modalFade 0.2s var(--easing);
}
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal[hidden] { display: none; }
.modal-card {
  width: 100%;
  max-width: 480px;
  background: linear-gradient(180deg, rgba(28,28,28,0.95), rgba(14,14,14,0.98));
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.7);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.modal-head h3 {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  color: var(--gold-light);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.modal-actions #svcDeleteBtn { margin-right: auto; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 18px;
  background: rgba(20,20,20,0.95);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 0.88rem;
  z-index: 60;
  box-shadow: 0 14px 28px rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  animation: toastUp 0.25s var(--easing);
}
@keyframes toastUp {
  from { transform: translate(-50%, 12px); opacity: 0; }
  to   { transform: translate(-50%, 0);    opacity: 1; }
}
.toast[hidden] { display: none; }
.toast-success { border-color: rgba(43, 214, 106, 0.5); color: #C8F4D6; }
.toast-error   { border-color: rgba(224, 72, 72, 0.5); color: #F5C5C5; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .service-row { grid-template-columns: auto 1fr auto; }
  .service-row-price { grid-column: 1 / -1; justify-self: start; }
  .gallery-row { grid-template-columns: auto 64px 1fr auto; }
  .gallery-thumb { width: 64px; height: 64px; }
  .hours-list .hours-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "day closed"
      "open dash"
      "close .";
  }
  .hours-list .hours-day { grid-area: day; }
  .hours-list .check     { grid-area: closed; justify-self: end; }
  .hours-list input[type="time"]:nth-of-type(1) { grid-area: open; }
  .hours-list .dash      { display: none; }
  .hours-list input[type="time"]:nth-of-type(2) { grid-area: close; }
  .topbar-title { font-size: 1rem; }
  .tab { font-size: 0.78rem; padding: 8px 10px; }
}
