/* ══════════════════════════════════════════════════════
   VIAJORA ADMIN PANEL
   ══════════════════════════════════════════════════════ */
:root {
  --bg:        #0B2531;
  --bg2:       #0F3344;
  --bg3:       #164F67;
  --surface:   #1A5568;
  --border:    rgba(255,255,255,.09);
  --text:      #E8E4DC;
  --muted:     rgba(255,255,255,.5);
  --gold:      #C49A30;
  --gold-l:    #DEB354;
  --teal:      #2487AC;
  --teal-l:    #4AAECB;
  --copper:    #C4613D;
  --white:     #FFFFFF;
  --danger:    #c0392b;
  --success:   #1e8449;
  --serif:     'Playfair Display', Georgia, serif;
  --sans:      'Inter', system-ui, sans-serif;
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 24px; --r-full: 9999px;
  --shadow-md: 0 4px 20px rgba(0,0,0,.25);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.35);
  --ease: 200ms ease;
  --sidebar-w: 220px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal-l); text-decoration: none; }
button { font-family: var(--sans); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--sans); }

/* ── Login ──────────────────────────────────────────── */
.page-login { display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: radial-gradient(ellipse at 30% 60%, rgba(36,135,172,.2) 0%, transparent 60%), var(--bg); }
#login-screen { width: 100%; max-width: 400px; padding: 1rem; }
.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: var(--shadow-lg);
}
.login-logo { display: flex; align-items: center; gap: .75rem; margin-bottom: .25rem; }
.login-logo img { width: 44px; height: 44px; border-radius: 8px; }
.login-logo span { font-family: var(--serif); font-size: 1.4rem; font-weight: 700; color: var(--white); letter-spacing: .1em; }
.login-card h2 { font-family: var(--serif); font-size: 1.5rem; color: var(--white); }
.login-card > p { font-size: .85rem; color: var(--muted); }
#login-form { display: flex; flex-direction: column; gap: 1rem; }
.login-field { display: flex; flex-direction: column; gap: .4rem; }
.login-field label { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.login-field input {
  padding: .7rem 1rem;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--white);
  font-size: .95rem;
  transition: border-color var(--ease);
}
.login-field input:focus { outline: none; border-color: var(--gold); }
.pass-wrapper { position: relative; }
.pass-wrapper input { width: 100%; padding-right: 2.8rem; }
#toggle-pass {
  position: absolute; right: .75rem; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: .9rem; transition: color var(--ease);
}
#toggle-pass:hover { color: var(--white); }
.login-error {
  font-size: .82rem;
  background: rgba(192,57,43,.2);
  border: 1px solid rgba(192,57,43,.4);
  border-radius: var(--r-sm);
  padding: .6rem .8rem;
  color: #f5a48e;
}
.btn-login {
  background: var(--gold);
  color: var(--white);
  font-weight: 700;
  font-size: .95rem;
  padding: .85rem;
  border-radius: var(--r-full);
  transition: all var(--ease);
  margin-top: .25rem;
}
.btn-login:hover { background: var(--gold-l); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.back-link { font-size: .8rem; color: var(--muted); text-align: center; display: block; transition: color var(--ease); }
.back-link:hover { color: var(--white); }

/* ── Dashboard layout ───────────────────────────────── */
#admin-dashboard { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

/* Sidebar */
.admin-sidebar {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 0 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.sidebar-logo img { width: 32px; height: 32px; border-radius: 6px; }
.sidebar-logo span { font-family: var(--serif); font-size: 1.1rem; font-weight: 700; color: var(--white); }
.sidebar-nav { display: flex; flex-direction: column; gap: .25rem; padding: 0 .75rem; flex: 1; }
.nav-btn {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem 1rem;
  border-radius: var(--r-md);
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  transition: all var(--ease);
  text-align: left;
}
.nav-btn:hover { background: rgba(255,255,255,.06); color: var(--white); }
.nav-btn.active { background: rgba(196,154,48,.15); color: var(--gold-l); }
.nav-btn i { width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem 1.75rem;
  font-size: .82rem;
  color: var(--muted);
  margin-top: .5rem;
  transition: color var(--ease);
}
.sidebar-logout:hover { color: var(--danger); }

/* Main */
.admin-main { padding: 2rem; overflow-x: hidden; }
.admin-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: .5rem;
}
.admin-header h1 { font-family: var(--serif); font-size: 1.75rem; color: var(--white); }
.admin-date { font-size: .8rem; color: var(--muted); }

/* ── Stats grid ─────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  background: rgba(36,135,172,.2);
  color: var(--teal-l);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.stat-icon.gold { background: rgba(196,154,48,.2); color: var(--gold-l); }
.stat-icon.copper { background: rgba(196,97,61,.2); color: #E8906E; }
.stat-icon.teal { background: rgba(36,135,172,.2); color: var(--teal-l); }
.stat-num { font-family: var(--serif); font-size: 1.75rem; color: var(--white); line-height: 1; }
.stat-label { font-size: .75rem; color: var(--muted); margin-top: .2rem; }

/* ── Admin sections ─────────────────────────────────── */
.admin-section { margin-bottom: 2rem; }
.admin-section h3 {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--white);
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}

/* Plan stats */
.plan-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .75rem; }
.plan-stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1rem 1.25rem;
}
.plan-stat-name { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .5rem; }
.plan-stat-count { font-family: var(--serif); font-size: 1.75rem; color: var(--white); }
.plan-stat-revenue { font-size: .8rem; color: var(--gold); margin-top: .1rem; }

/* ── Tables ─────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead { background: rgba(255,255,255,.04); }
th {
  padding: .75rem 1rem;
  text-align: left;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  white-space: nowrap;
}
td { padding: .75rem 1rem; border-top: 1px solid var(--border); color: var(--text); vertical-align: middle; }
tr:hover td { background: rgba(255,255,255,.025); }
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: var(--r-full);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.badge-paid { background: rgba(30,132,73,.25); color: #82e0aa; }
.badge-pending { background: rgba(196,154,48,.2); color: var(--gold-l); }
.badge-researcher { background: rgba(196,154,48,.15); color: var(--gold); }
.badge-starter { background: rgba(36,135,172,.15); color: var(--teal-l); }
.badge-deep { background: rgba(78,205,196,.15); color: #4ecdc4; }
.badge-concierge { background: rgba(196,97,61,.15); color: #E8906E; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  padding: 3rem;
  color: var(--muted);
  text-align: center;
  font-size: .9rem;
}
.empty-state i { font-size: 2rem; opacity: .4; }

/* ── Slots tab ──────────────────────────────────────── */
.slots-layout { display: grid; grid-template-columns: 320px 1fr; gap: 1.5rem; align-items: start; }
.add-slot-card, .slots-list-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
}
.add-slot-card h3, .slots-list-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.add-slot-card h3 i { color: var(--gold); }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: 1rem; }
.admin-field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .75rem; }
.admin-field label { font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.admin-field input, .admin-field select {
  padding: .6rem .85rem;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--white);
  font-size: .875rem;
  transition: border-color var(--ease);
  width: 100%;
}
.admin-field input:focus, .admin-field select:focus { outline: none; border-color: var(--gold); }
.admin-field select option { background: var(--bg2); }
.quick-add { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.quick-add p { font-size: .82rem; color: var(--muted); margin-bottom: .75rem; }
.quick-times {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}
.quick-times label {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .8rem;
  color: var(--text);
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: .3rem .65rem;
  cursor: pointer;
  transition: all var(--ease);
}
.quick-times label:hover { border-color: var(--gold); }
.quick-times input[type="checkbox"] { accent-color: var(--gold); }
.slots-list-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.slots-list-header h3 { margin-bottom: 0; }

/* ── Bookings tab ───────────────────────────────────── */
.bookings-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: .75rem;
}
.filter-group { display: flex; align-items: center; gap: .6rem; font-size: .85rem; color: var(--muted); }
.filter-group select {
  padding: .4rem .8rem;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--white);
  font-size: .85rem;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn-admin-primary {
  background: var(--gold);
  color: var(--white);
  font-weight: 600;
  font-size: .875rem;
  padding: .7rem 1.25rem;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  gap: .4rem;
  width: 100%;
  justify-content: center;
  transition: all var(--ease);
}
.btn-admin-primary:hover { background: var(--gold-l); }
.btn-admin-secondary {
  background: rgba(255,255,255,.07);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: .82rem;
  font-weight: 500;
  padding: .5rem 1rem;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  gap: .4rem;
  transition: all var(--ease);
}
.btn-admin-secondary:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.2); }
.btn-admin-danger-sm {
  background: rgba(192,57,43,.15);
  border: 1px solid rgba(192,57,43,.3);
  color: #f5a48e;
  font-size: .78rem;
  font-weight: 600;
  padding: .4rem .85rem;
  border-radius: var(--r-full);
  transition: all var(--ease);
}
.btn-admin-danger-sm:hover { background: rgba(192,57,43,.3); }
.btn-delete-slot {
  background: none;
  color: rgba(255,255,255,.3);
  font-size: .85rem;
  padding: .2rem .5rem;
  border-radius: var(--r-sm);
  transition: all var(--ease);
}
.btn-delete-slot:hover { color: var(--danger); background: rgba(192,57,43,.1); }

/* ── Toast ───────────────────────────────────────────── */
#admin-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--gold);
  color: var(--white);
  padding: .75rem 1.25rem;
  border-radius: var(--r-md);
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(12px);
  transition: all 250ms ease;
  pointer-events: none;
  z-index: 999;
}
#admin-toast.visible { opacity: 1; transform: translateY(0); }
#admin-toast.error { background: var(--danger); }

/* ── Mobile top bar (shown when sidebar is hidden) ───── */
.admin-mobile-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.25rem;
  align-items: center;
  justify-content: space-between;
}
.admin-mobile-bar .sidebar-logo { padding: 0; border: none; margin: 0; }
.admin-mobile-nav {
  display: flex;
  gap: .25rem;
}
.admin-mobile-nav .nav-btn {
  padding: .5rem .75rem;
  font-size: .75rem;
  border-radius: var(--r-md);
  background: rgba(255,255,255,.05);
}
.admin-mobile-nav .nav-btn.active { background: rgba(196,154,48,.2); color: var(--gold-l); }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .slots-layout { grid-template-columns: 1fr; }
  .form-row-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  #admin-dashboard { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
  .admin-mobile-bar { display: flex; }
  .admin-main { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .admin-header { flex-direction: column; gap: .25rem; }
  .admin-header h1 { font-size: 1.35rem; }
  .bookings-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .admin-mobile-nav .nav-btn span { display: none; }
  .admin-mobile-nav .nav-btn { padding: .5rem; }
  .tab-btn { padding: .5rem .75rem; font-size: .75rem; }
  .admin-main { padding: .75rem; }
}

/* ── Messages Inbox ──────────────────────────────────── */
.msg-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-full);
  background: #e74c3c;
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  margin-left: .4rem;
  vertical-align: middle;
}

.messages-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.messages-unread-label {
  font-size: .85rem;
  color: var(--muted);
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.msg-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.1rem 1.25rem;
  transition: border-color var(--ease);
}
.msg-card.msg-unread {
  border-color: rgba(36,135,172,.45);
  background: rgba(36,135,172,.06);
}

.msg-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: .5rem;
  flex-wrap: wrap;
}
.msg-sender { display: flex; flex-direction: column; gap: .1rem; }
.msg-name { font-weight: 600; font-size: .95rem; color: var(--text); }
.msg-email { font-size: .78rem; color: var(--teal-l); }
.msg-meta { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.msg-date { font-size: .75rem; color: var(--muted); }
.msg-unread-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--teal-l);
  flex-shrink: 0;
}

.msg-subject {
  font-size: .78rem;
  color: var(--gold-l);
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  gap: .35rem;
}

.msg-body {
  font-size: .875rem;
  color: rgba(255,255,255,.75);
  line-height: 1.6;
  margin-bottom: .85rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.btn-msg-action {
  font-size: .75rem;
  padding: .3rem .75rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: all var(--ease);
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.btn-msg-action:hover { background: var(--bg3); color: var(--text); border-color: rgba(255,255,255,.2); }
.btn-msg-delete:hover { border-color: rgba(192,57,43,.5); color: #f5a48e; }

@media (max-width: 480px) {
  .msg-card { padding: .85rem 1rem; }
  .messages-toolbar { flex-direction: column; align-items: flex-start; }
}
