/* ─── Google Fonts ─── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ─── CSS Variables ─── */
:root {
  --bs-body-bg: #0d0d0f;
  --bs-body-color: #e8e4dc;
  --bs-border-color: #2a2a2e;

  --gold:        #c9a84c;
  --gold-light:  #e6c97a;
  --gold-dim:    #7a6330;
  --cream:       #f0ead8;
  --charcoal:    #1a1a1e;
  --charcoal-2:  #222226;
  --charcoal-3:  #2c2c32;
  --muted:       #6b6b72;
  --text-soft:   #b0aaA0;

  --sidebar-w:   260px;
  --topbar-h:    64px;
  --radius:      10px;
  --radius-lg:   16px;

  --shadow-card: 0 4px 24px rgba(0,0,0,.45);
  --shadow-glow: 0 0 20px rgba(201,168,76,.12);

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', sans-serif;

  --transition: all .2s ease;
}

/* ─── Reset / Base ─── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3,h4,h5,h6 {
  font-family: var(--font-display);
  color: var(--cream);
  font-weight: 600;
  line-height: 1.25;
}

a { color: var(--gold); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--gold-light); }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--charcoal); }
::-webkit-scrollbar-thumb { background: var(--charcoal-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

/* ════════════════════════════════════════
   LAYOUT
════════════════════════════════════════ */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--charcoal);
  border-right: 1px solid var(--bs-border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 1040;
  transition: transform .3s ease;
}

.sidebar-brand {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--bs-border-color);
}

.sidebar-brand .brand-icon {
  width: 38px; height: 38px;
  background: var(--gold);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: #000;
  margin-bottom: 10px;
}

.sidebar-brand .brand-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--cream);
  display: block;
  letter-spacing: 0.02em;
}

.sidebar-brand .brand-tagline {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sidebar-nav {
  padding: 16px 0;
  flex: 1;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding: 14px 24px 6px;
  font-weight: 600;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 400;
  border-radius: 0;
  transition: var(--transition);
  position: relative;
}

.sidebar-nav .nav-link i {
  font-size: 17px;
  width: 20px;
  flex-shrink: 0;
  opacity: .75;
}

.sidebar-nav .nav-link:hover {
  color: var(--cream);
  background: rgba(201,168,76,.07);
}

.sidebar-nav .nav-link.active {
  color: var(--gold);
  background: rgba(201,168,76,.1);
  font-weight: 500;
}

.sidebar-nav .nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--gold);
  border-radius: 0 2px 2px 0;
}

.sidebar-nav .nav-link.active i { opacity: 1; }

.sidebar-nav .badge-nav {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
}

.sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid #ddd;
  padding: 0.75rem;
}

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
}

.sidebar-user .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--charcoal-3);
  border: 2px solid var(--gold-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  color: var(--gold);
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-user .user-info .user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--cream);
  display: block;
  line-height: 1.2;
}

.sidebar-user .user-info .user-role {
  font-size: 11px;
  color: var(--muted);
  text-transform: capitalize;
}

/* ─── Main Content ─── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Topbar ─── */
.topbar {
  height: var(--topbar-h);
  background: rgba(13,13,15,.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bs-border-color);
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0; z-index: 1030;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--cream);
  font-weight: 600;
  flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.topbar-btn {
  width: 38px; height: 38px;
  background: var(--charcoal-2);
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-soft);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.topbar-btn:hover {
  border-color: var(--gold-dim);
  color: var(--gold);
}

.topbar-btn .notif-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: var(--gold);
  border-radius: 50%;
  border: 1.5px solid var(--charcoal-2);
}

/* ─── Page Body ─── */
.page-body {
  padding: 28px;
  flex: 1;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 1.6rem;
  margin: 0 0 4px;
}

.page-header p {
  color: var(--muted);
  margin: 0;
  font-size: 14px;
}

/* ════════════════════════════════════════
   COMPONENTS
════════════════════════════════════════ */

/* ─── Cards ─── */
.card {
  background: var(--charcoal);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--bs-border-color);
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
}

.card-header .card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--cream);
  margin: 0;
  font-weight: 600;
}

.card-body { padding: 20px; }

/* ─── Stat Cards ─── */
.stat-card {
  background: var(--charcoal);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--gold-dim);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 0 var(--radius-lg) 0 80px;
  background: rgba(201,168,76,.05);
}

.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}

.stat-card .stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 500;
}

.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--cream);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-card .stat-change {
  font-size: 12px;
  display: flex; align-items: center; gap: 4px;
}

.stat-card .stat-change.up   { color: #4caf82; }
.stat-card .stat-change.down { color: #e05c5c; }

/* Icon backgrounds */
.icon-gold   { background: rgba(201,168,76,.15); color: var(--gold); }
.icon-teal   { background: rgba(56,178,172,.15); color: #38b2ac; }
.icon-rose   { background: rgba(236,72,153,.12); color: #ec4899; }
.icon-blue   { background: rgba(99,102,241,.15); color: #818cf8; }
.icon-green  { background: rgba(76,175,130,.15); color: #4caf82; }
.icon-red    { background: rgba(224,92,92,.15);  color: #e05c5c; }

/* ─── Buttons ─── */
.btn {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  border-radius: 8px;
  transition: var(--transition);
  letter-spacing: 0.01em;
}

.btn-gold {
  background: var(--gold);
  color: #000;
  border: none;
  box-shadow: 0 2px 12px rgba(201,168,76,.3);
}
.btn-gold:hover {
  background: var(--gold-light);
  color: #000;
  box-shadow: 0 4px 20px rgba(201,168,76,.45);
  transform: translateY(-1px);
}

.btn-outline-gold {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
}
.btn-outline-gold:hover {
  background: rgba(201,168,76,.1);
  color: var(--gold-light);
  border-color: var(--gold);
}

.btn-ghost {
  background: var(--charcoal-2);
  color: var(--text-soft);
  border: 1px solid var(--bs-border-color);
}
.btn-ghost:hover {
  background: var(--charcoal-3);
  color: var(--cream);
  border-color: var(--muted);
}

.btn-danger-soft {
  background: rgba(224,92,92,.12);
  color: #e05c5c;
  border: 1px solid rgba(224,92,92,.25);
}
.btn-danger-soft:hover {
  background: rgba(224,92,92,.22);
  color: #f07070;
}

/* ─── Tables ─── */
.table {
  color: var(--bs-body-color);
  font-size: 14px;
}

.table thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--bs-border-color);
  padding: 12px 16px;
  white-space: nowrap;
  font-family: var(--font-body);
  background: transparent;
}

.table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(42,42,46,.7);
  vertical-align: middle;
  color: var(--text-soft);
}

.table tbody tr:last-child td { border-bottom: none; }

.table tbody tr:hover td {
  background: rgba(201,168,76,.03);
  color: var(--cream);
}

/* ─── Badges ─── */
.badge {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

.badge-Pendiente    { background: rgba(201,168,76,.15);  color: var(--gold); }
.badge-Confirmada  { background: rgba(76,175,130,.15);  color: #4caf82; }
.badge-Atendida  { background: rgba(99,102,241,.15);  color: #818cf8; }
.badge-cancelled  { background: rgba(224,92,92,.12);   color: #e05c5c; }
.badge-Atendiendo{ background: rgba(56,178,172,.15);  color: #38b2ac; }
.badge-no_show    { background: rgba(107,107,114,.15); color: var(--muted); }

.badge-Pagado       { background: rgba(76,175,130,.15);  color: #4caf82; }
.badge-abierto       { background: rgba(201,168,76,.15);  color: var(--gold); }
.badge-reembolso   { background: rgba(56,178,172,.15);  color: #38b2ac; }
.badge-cancelado       { background: rgba(107,107,114,.15); color: var(--muted); }
.badge-low        { background: rgba(224,92,92,.12);   color: #e05c5c; }
.badge-ok         { background: rgba(76,175,130,.15);  color: #4caf82; }

/* ─── Forms ─── */
.form-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.form-control, .form-select {
  background: var(--charcoal-2);
  border: 1px solid var(--bs-border-color);
  color: var(--bs-body-color);
  border-radius: 8px;
  font-size: 14px;
  padding: 10px 14px;
  transition: var(--transition);
}

.form-control:focus, .form-select:focus {
  background: var(--charcoal-2);
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(201,168,76,.12);
  color: var(--bs-body-color);
}

.form-control::placeholder { color: var(--muted); }

.form-select option {
  background: var(--charcoal-2);
  color: var(--bs-body-color);
}

.input-group-text {
  background: var(--charcoal-3);
  border: 1px solid var(--bs-border-color);
  color: var(--muted);
  border-radius: 8px;
}

/* ─── Modals ─── */
.modal-content {
  background: var(--charcoal);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.7);
}

.modal-header {
  border-bottom: 1px solid var(--bs-border-color);
  padding: 20px 24px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--cream);
}

.modal-body { padding: 24px; }
.modal-footer {
  border-top: 1px solid var(--bs-border-color);
  padding: 16px 24px;
}

.btn-close {
  filter: invert(1) opacity(.5);
}
.btn-close:hover { filter: invert(1) opacity(.8); }

.modal-backdrop { backdrop-filter: blur(4px); }

/* ─── Dropdowns ─── */
.dropdown-menu {
  background: var(--charcoal-2);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  padding: 6px;
  min-width: 180px;
}

.dropdown-item {
  color: var(--text-soft);
  font-size: 14px;
  border-radius: 6px;
  padding: 8px 12px;
  transition: var(--transition);
  display: flex; align-items: center; gap: 8px;
}

.dropdown-item:hover {
  background: rgba(201,168,76,.08);
  color: var(--cream);
}

.dropdown-item i { font-size: 15px; opacity: .7; }
.dropdown-divider { border-color: var(--bs-border-color); margin: 4px 0; }

/* ─── Alerts ─── */
.alert {
  border-radius: var(--radius);
  font-size: 14px;
  border: 1px solid;
}

.alert-success {
  background: rgba(76,175,130,.1);
  border-color: rgba(76,175,130,.25);
  color: #4caf82;
}

.alert-danger {
  background: rgba(224,92,92,.1);
  border-color: rgba(224,92,92,.25);
  color: #e05c5c;
}

.alert-warning {
  background: rgba(201,168,76,.1);
  border-color: rgba(201,168,76,.25);
  color: var(--gold);
}

.alert-info {
  background: rgba(99,102,241,.1);
  border-color: rgba(99,102,241,.25);
  color: #818cf8;
}

/* ─── Pagination ─── */
.pagination {
  gap: 4px;
}

.page-link {
  background: var(--charcoal-2);
  border: 1px solid var(--bs-border-color);
  color: var(--text-soft);
  border-radius: 8px !important;
  font-size: 13px;
  padding: 6px 12px;
  transition: var(--transition);
}

.page-link:hover {
  background: var(--charcoal-3);
  color: var(--gold);
  border-color: var(--gold-dim);
}

.page-item.active .page-link {
  background: var(--gold);
  border-color: var(--gold);
  color: #000;
  font-weight: 600;
}

.page-item.disabled .page-link {
  background: var(--charcoal);
  color: var(--muted);
  opacity: .5;
}

/* ─── Avatar ─── */
.avatar {
  border-radius: 50%;
  display: inline-flex;
  align-items: center; justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar-sm  { width: 32px; height: 32px; font-size: 12px; }
.avatar-md  { width: 40px; height: 40px; font-size: 15px; }
.avatar-lg  { width: 52px; height: 52px; font-size: 18px; }
.avatar-xl  { width: 72px; height: 72px; font-size: 26px; }

.avatar-gold  { background: rgba(201,168,76,.2); color: var(--gold); border: 2px solid var(--gold-dim); }
.avatar-teal  { background: rgba(56,178,172,.2); color: #38b2ac; border: 2px solid rgba(56,178,172,.4); }
.avatar-rose  { background: rgba(236,72,153,.15); color: #ec4899; border: 2px solid rgba(236,72,153,.3); }
.avatar-blue  { background: rgba(99,102,241,.2); color: #818cf8; border: 2px solid rgba(99,102,241,.4); }

/* ─── Search Bar ─── */
.search-bar {
  position: relative;
  flex: 1;
  max-width: 340px;
}

.search-bar i {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 15px;
}

.search-bar input {
  padding-left: 38px;
  background: var(--charcoal-2);
  border: 1px solid var(--bs-border-color);
  color: var(--bs-body-color);
  border-radius: 8px;
  font-size: 14px;
  height: 38px;
  width: 100%;
  transition: var(--transition);
}

.search-bar input:focus {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(201,168,76,.1);
}

/* ─── Divider ─── */
.divider {
  border: none;
  border-top: 1px solid var(--bs-border-color);
  margin: 20px 0;
}

/* ─── Gold Accent Line ─── */
.gold-line {
  width: 40px; height: 3px;
  background: var(--gold);
  border-radius: 2px;
  margin-bottom: 16px;
}

/* ─── Loading Spinner ─── */
.spinner-gold {
  color: var(--gold);
}

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state i {
  font-size: 40px;
  color: var(--muted);
  margin-bottom: 16px;
  opacity: .4;
}

.empty-state p {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

/* ─── Timeline ─── */
.timeline {
  position: relative;
  padding-left: 20px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 6px; top: 4px; bottom: 0;
  width: 1px;
  background: var(--bs-border-color);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
  padding-left: 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -14px; top: 6px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--gold-dim);
  border: 2px solid var(--charcoal);
}

.timeline-item:last-child { padding-bottom: 0; }

/* ─── Status Dot ─── */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.dot-green  { background: #4caf82; box-shadow: 0 0 6px rgba(76,175,130,.5); }
.dot-gold   { background: var(--gold); box-shadow: 0 0 6px rgba(201,168,76,.5); }
.dot-red    { background: #e05c5c; box-shadow: 0 0 6px rgba(224,92,92,.5); }
.dot-gray   { background: var(--muted); }
.dot-blue   { background: #818cf8; box-shadow: 0 0 6px rgba(129,140,248,.5); }
.dot-teal   { background: #38b2ac; box-shadow: 0 0 6px rgba(56,178,172,.5); }

/* ─── Toasts ─── */
.toast {
  background: var(--charcoal-2);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--radius);
  color: var(--bs-body-color);
  font-size: 14px;
}

.toast-header {
  background: transparent;
  border-bottom: 1px solid var(--bs-border-color);
  color: var(--cream);
  font-weight: 500;
}

/* ─── Sidebar Toggle (mobile) ─── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 1035;
  backdrop-filter: blur(2px);
}

/* ─── Animations ─── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}

.anim-fadeInUp  { animation: fadeInUp .35s ease both; }
.anim-fadeIn    { animation: fadeIn   .25s ease both; }
.anim-delay-1   { animation-delay: .06s; }
.anim-delay-2   { animation-delay: .12s; }
.anim-delay-3   { animation-delay: .18s; }
.anim-delay-4   { animation-delay: .24s; }

/* ─── Responsive ─── */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.show { display: block; }

  .main-content { margin-left: 0; }

  .page-body { padding: 16px; }

  .topbar { padding: 0 16px; }
}

@media (max-width: 576px) {
  .stat-card .stat-value { font-size: 1.5rem; }
  .page-header h1 { font-size: 1.3rem; }
}

/* Sidebar para móviles */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 80%;
    height: 100vh;
    overflow-y: auto;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
}

/* Sidebar para tablets y laptops medianos */
@media (max-width: 992px) {
  .sidebar {
    position: fixed;
    width: 250px;          /* más estrecho en pantallas medianas */
    height: 100vh;
    overflow-y: auto;
  }
  .sidebar .brand-name {
    font-size: 0.9rem;     /* reduce tipografía */
  }
  .sidebar .nav-link {
    font-size: 0.85rem;    /* enlaces más compactos */
    padding: 0.5rem 0.75rem;
  }
}


/* ─── Utility ─── */
.text-gold    { color: var(--gold) !important; }
.text-muted   { color: var(--muted) !important; }
.text-cream   { color: var(--cream) !important; }
.text-soft    { color: var(--text-soft) !important; }

.bg-charcoal  { background: var(--charcoal) !important; }
.bg-charcoal2 { background: var(--charcoal-2) !important; }

.border-gold  { border-color: var(--gold-dim) !important; }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }

.font-display { font-family: var(--font-display); }

.rounded-10 { border-radius: 10px; }
.rounded-16 { border-radius: 16px; }

.cursor-pointer { cursor: pointer; }

.gap-2 { gap: .5rem; }
.gap-3 { gap: 1rem; }
