/* ============================================================
   HOTEL SITES DASHBOARD — Design System
   ============================================================ */

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

/* ── Variables ── */
:root {
  --sidebar-width: 240px;
  --sidebar-bg: #0f172a;
  --sidebar-border: rgba(255,255,255,0.06);
  --sidebar-text: #94a3b8;
  --sidebar-hover: rgba(255,255,255,0.07);
  --sidebar-active-bg: rgba(99,102,241,0.18);
  --sidebar-active-text: #a5b4fc;
  --sidebar-active-border: #6366f1;

  --content-bg: #f1f5f9;
  --card-bg: #ffffff;
  --card-shadow: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --card-shadow-hover: 0 4px 12px rgba(0,0,0,.10);
  --card-radius: 0.75rem;

  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  --accent-blue:   #3b82f6;
  --accent-green:  #10b981;
  --accent-purple: #8b5cf6;
  --accent-amber:  #f59e0b;
  --accent-red:    #ef4444;
  --accent-indigo: #6366f1;
  --accent-teal:   #14b8a6;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--content-bg);
  color: var(--text-primary);
  margin: 0;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  border-right: 1px solid var(--sidebar-border);
  overflow: hidden;
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.4rem 1.25rem 1rem;
  border-bottom: 1px solid var(--sidebar-border);
  text-decoration: none;
  flex-shrink: 0;
}

.sidebar-brand-icon {
  width: 32px; height: 32px;
  background: var(--accent-indigo);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-weight: 700;
  font-size: 1rem;
  color: #f1f5f9;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 0.65rem;
  color: var(--sidebar-text);
  font-weight: 400;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sidebar-text);
  padding: 0.75rem 0.75rem 0.35rem;
  opacity: 0.6;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.875rem;
  border-radius: 0.5rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
  border-left: 2px solid transparent;
}

.sidebar-link i {
  width: 16px;
  text-align: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}

.sidebar-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border-left-color: var(--sidebar-active-border);
}

/* Footer */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.sidebar-user-avatar {
  width: 30px; height: 30px;
  background: rgba(99,102,241,0.25);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--sidebar-active-text);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.sidebar-user-email {
  font-size: 0.75rem;
  color: var(--sidebar-text);
  word-break: break-all;
  line-height: 1.3;
}

.btn-sidebar-logout {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--sidebar-text);
  border-radius: 0.5rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-sidebar-logout:hover {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.3);
  color: #fca5a5;
}

/* Hamburger toggle (mobile) */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1050;
  background: var(--sidebar-bg);
  border: 1px solid var(--sidebar-border);
  color: #e2e8f0;
  width: 38px; height: 38px;
  border-radius: 0.5rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background 0.15s;
}

.sidebar-toggle:hover { background: #1e293b; }

/* Overlay mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1039;
  backdrop-filter: blur(2px);
}

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

/* ============================================================
   MAIN CONTENT
   ============================================================ */

.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: var(--content-bg);
}

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

/* Top bar dentro del contenido */
.content-topbar {
  background: var(--card-bg);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.content-topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ============================================================
   KPI CARDS
   ============================================================ */

.kpi {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  padding: 1.25rem 1.25rem 1rem;
  box-shadow: var(--card-shadow);
  border-left: 3px solid transparent;
  position: relative;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.kpi:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-1px);
}

/* Color variants */
.kpi-blue   { border-left-color: var(--accent-blue); }
.kpi-green  { border-left-color: var(--accent-green); }
.kpi-purple { border-left-color: var(--accent-purple); }
.kpi-amber  { border-left-color: var(--accent-amber); }
.kpi-red    { border-left-color: var(--accent-red); }
.kpi-indigo { border-left-color: var(--accent-indigo); }
.kpi-teal   { border-left-color: var(--accent-teal); }

/* Icon en bottom-right (para no tapar el badge del top-right) */
.kpi-icon {
  position: absolute;
  bottom: 0.9rem;
  right: 1rem;
  font-size: 1.1rem;
  opacity: 0.35;
}

.kpi-blue   .kpi-icon { color: var(--accent-blue); opacity: 0.5; }
.kpi-green  .kpi-icon { color: var(--accent-green); opacity: 0.5; }
.kpi-purple .kpi-icon { color: var(--accent-purple); opacity: 0.5; }
.kpi-amber  .kpi-icon { color: var(--accent-amber); opacity: 0.5; }
.kpi-red    .kpi-icon { color: var(--accent-red); opacity: 0.5; }
.kpi-indigo .kpi-icon { color: var(--accent-indigo); opacity: 0.5; }
.kpi-teal   .kpi-icon { color: var(--accent-teal); opacity: 0.5; }

.kpi-badge {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.kpi-title {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.1rem;
}

.kpi-subtitle {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-bottom: 0.4rem;
}

.kpi-value {
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  line-height: 1.1;
}

/* Overrides para display-5/display-6 en cards compactas */
.kpi .display-5 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.kpi .display-6 { font-size: clamp(1.3rem, 2.5vw, 1.75rem); }

/* Brand box */
.brand-box {
  border: 2px solid rgba(99,102,241,0.3);
  background: rgba(99,102,241,0.05);
  padding: 0.6rem 0.9rem;
  font-weight: 800;
  font-size: 0.8rem;
  line-height: 1.3;
  text-align: right;
  color: var(--accent-indigo);
  border-radius: 0.5rem;
  letter-spacing: 0.05em;
}

/* Section divider */
.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  margin-top: 0.25rem;
}

/* ============================================================
   FILTROS
   ============================================================ */

.filters-card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--card-shadow);
  margin-bottom: 1.25rem;
}

.btn-prop {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 0.5rem;
  border: 1.5px solid #d1d5db;
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.15s;
  text-decoration: none;
}

.btn-prop:hover {
  border-color: var(--accent-indigo);
  color: var(--accent-indigo);
  background: rgba(99,102,241,0.05);
}

.btn-prop.active {
  background: var(--accent-indigo);
  border-color: var(--accent-indigo);
  color: white;
}

/* ============================================================
   MÉTRICAS FINANCIERAS (PANEL FLOTANTE)
   ============================================================ */

.financial-metrics-toggle {
  position: fixed;
  bottom: 24px;
  left: calc(var(--sidebar-width) + 20px);
  z-index: 1000;
  border-radius: 50px;
  padding: 0.65rem 1.2rem;
  font-weight: 600;
  font-size: 0.875rem;
  box-shadow: 0 4px 14px rgba(99,102,241,0.35);
  transition: all 0.2s ease;
  border: none;
  background: var(--accent-indigo);
  color: white;
}

.financial-metrics-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(99,102,241,0.45);
  background: #4f46e5;
  color: white;
}

.financial-metrics-toggle.active {
  background: #4338ca;
  box-shadow: 0 2px 8px rgba(99,102,241,0.5);
}

.financial-metrics-panel {
  position: fixed;
  bottom: 80px;
  left: calc(var(--sidebar-width) + 20px);
  right: 20px;
  max-width: 1100px;
  z-index: 999;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.financial-metrics-panel.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.financial-metrics-panel .card {
  border-radius: 0.875rem;
  overflow: hidden;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.financial-metrics-panel .card-header {
  background: linear-gradient(135deg, var(--accent-indigo) 0%, #4338ca 100%);
  flex-shrink: 0;
  padding: 0.75rem 1rem;
}

.financial-metrics-panel .card-body {
  overflow-y: auto;
  flex-grow: 1;
}

.financial-metrics-panel .table td {
  padding: 0.55rem 0.8rem;
  font-size: 0.825rem;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.financial-metrics-panel .table tbody tr:hover {
  background-color: rgba(99,102,241,0.04);
}

.financial-metrics-panel .table thead th {
  background-color: #f8fafc;
  font-weight: 600;
  font-size: 0.775rem;
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 0.55rem 0.8rem;
}

.financial-metrics-panel .table td:first-child,
.financial-metrics-panel .table th:first-child {
  position: sticky;
  left: 0;
  background-color: white;
  z-index: 5;
  font-weight: 600;
}

.financial-metrics-panel .table thead th:first-child {
  z-index: 15;
  background-color: #f8fafc;
}

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */

@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.25);
  }

  .main-content {
    margin-left: 0;
    padding-top: 3.5rem; /* espacio para el botón hamburger */
  }

  .sidebar-toggle {
    display: flex;
  }

  .financial-metrics-toggle {
    left: 20px;
    bottom: 15px;
  }

  .financial-metrics-toggle:hover {
    transform: translateY(-2px);
  }

  .financial-metrics-panel {
    left: 10px;
    right: 10px;
    width: auto;
    bottom: 70px;
  }

  /* Cards más compactas en mobile */
  .kpi { padding: 1rem; }
  .kpi .display-5 { font-size: 1.8rem; }
  .kpi .display-6 { font-size: 1.4rem; }
}

@media (max-width: 576px) {
  .filters-card { padding: 0.75rem; }
  .kpi .display-5 { font-size: 1.6rem; }
  .kpi .display-6 { font-size: 1.3rem; }
}
