/* ===== SoyMendoza Anfitriones PWA - Estilos ===== */

/* Variables de tema claro */
:root {
  --primary: #793a80;
  --primary-dark: #4B1A8A;
  --accent: #de088d;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
  --info: #17a2b8;

  /* Colores de fondo y texto - Modo Claro */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --bg-panel: #ffffff;
  --bg-card: #ffffff;

  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;

  --border-color: #dee2e6;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);

  /* Navegación */
  --nav-bg: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
  --nav-text: #ffffff;
  --nav-active: rgba(255, 255, 255, 0.2);

  /* Pantallas laterales */
  --screen-bg: rgba(255, 255, 255, 0.98);
  --screen-overlay: rgba(0, 0, 0, 0.5);
}

/* Variables de tema oscuro */
[data-theme="dark"] {
  --bg-primary: #0b1220;
  --bg-secondary: #0f1724;
  --bg-tertiary: #1a2332;
  --bg-panel: #12192a;
  --bg-card: #1a2332;

  --text-primary: #f8f9fa;
  --text-secondary: #adb5bd;
  --text-muted: #6c757d;

  --border-color: #2d3748;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);

  --screen-bg: rgba(18, 25, 42, 0.98);
  --screen-overlay: rgba(0, 0, 0, 0.7);
}

/* Reset y base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Bootstrap Components Theme Override */
.card {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.card-body {
  background: var(--bg-card);
  color: var(--text-primary);
}

.card-title,
.card-header {
  color: var(--text-primary);
}

.table {
  color: var(--text-primary);
}

.table > :not(caption) > * > * {
  background-color: transparent;
  border-bottom-color: var(--border-color);
}

.table thead {
  background: var(--bg-secondary);
}

.accordion-button {
  background: var(--bg-card);
  color: var(--text-primary);
}

.accordion-body {
  background: var(--bg-card);
  color: var(--text-primary);
}

.modal-content {
  background: var(--bg-card);
  color: var(--text-primary);
}

.modal-header {
  border-bottom-color: var(--border-color);
}

.modal-footer {
  border-top-color: var(--border-color);
}

/* Login Page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 1rem;
}

.login-card {
  background: var(--bg-card);
  border-radius: 1.5rem;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-header {
  background: var(--nav-bg);
  color: white;
  padding: 2rem 1.5rem;
  text-align: center;
}

.login-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.login-body {
  padding: 2rem 1.5rem;
}

.form-floating {
  margin-bottom: 1rem;
}

.form-control {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.form-control:focus {
  background: var(--bg-card);
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(121, 58, 128, 0.25);
  color: var(--text-primary);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
  border: none;
  padding: 0.75rem;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(121, 58, 128, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Panel Principal */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-primary);
}

/* Header/Navbar */
.app-header {
  background: var(--nav-bg);
  color: var(--nav-text);
  padding: 1rem;
  box-shadow: var(--shadow);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  z-index: 1000;
  display: flex;
  align-items: center;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.theme-toggle {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* Bottom Navigation (Mobile) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 0.5rem 0;
  display: flex;
  justify-content: space-around;
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.3s ease;
  border-radius: 0.5rem;
  cursor: pointer;
}

.nav-item i {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.nav-item span {
  font-size: 0.75rem;
  font-weight: 500;
}

.nav-item.active {
  color: var(--primary);
  background: rgba(121, 58, 128, 0.1);
}

.nav-item:hover {
  color: var(--primary);
}

.nav-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.nav-item.disabled:hover {
  color: var(--text-secondary);
  background: transparent;
}

/* Pantallas laterales (basado en modelo.html) */
#pantallas-capa {
  position: relative;
  overflow: hidden;
  width: 100%;
  flex: 1;
  background: var(--bg-secondary);
  margin-top: 60px; /* Altura del header */
  margin-bottom: 90px; /* Espacio para bottom-nav */
  min-height: calc(100vh - 150px); /* 100vh - header - bottom-nav */
}

.pantallas-track {
  display: flex;
  height: 100%;
  transition: transform 400ms cubic-bezier(0.22, 0.9, 0.35, 1);
  will-change: transform;
}

.pantalla {
  min-width: 100%;
  height: 100%;
  padding: 1rem;
  box-sizing: border-box;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--screen-bg);
}

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

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-color);
}

.panel-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.panel-actions {
  display: flex;
  gap: 0.5rem;
}

/* Controles de navegación entre pantallas */
.screen-controls {
  position: fixed;
  bottom: 80px;
  right: 1rem;
  z-index: 50;
  display: flex;
  gap: 0.5rem;
}

.btn-screen {
  background: rgba(121, 58, 128, 0.9);
  color: white;
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
  cursor: pointer;
}

.btn-screen:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: scale(1.1);
}

.btn-screen:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Indicador de página */
.page-indicator {
  position: fixed;
  bottom: 80px;
  left: 1rem;
  z-index: 50;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
}

/* Cards de contenido */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
  cursor: pointer;
}

.content-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: var(--primary);
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 1.5rem;
  border-radius: 1rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  display: block;
}

.stat-card .stat-label {
  font-size: 0.875rem;
  opacity: 0.9;
  margin-top: 0.25rem;
  display: block;
}

/* Formularios */
.form-section {
  margin-bottom: 2rem;
}

.form-section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary);
}

/* Loading */
.loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 3rem;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Alerts */
.alert {
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  line-height: 1.6;
  display: flex;
  align-items: flex-start;
  gap: 0;
  word-break: break-word;
}

.alert > i.bi:first-child {
  flex-shrink: 0;
  margin-right: 0.75rem;
  margin-top: 0.125rem;
}

.alert > *:not(i:first-child) {
  flex: 1;
}

.alert .d-flex {
  width: 100%;
}

.alert .alert-heading {
  margin-bottom: 0.75rem;
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 0;
}

.alert p:last-child,
.alert ul:last-child,
.alert .row:last-child {
  margin-bottom: 0;
}

.alert ul {
  padding-left: 1.5rem;
  margin-top: 0.5rem;
}

.alert .alert-link {
  font-weight: 600;
  text-decoration: underline;
}

.alert .row {
  margin: 0;
}

.alert-success {
  background: rgba(40, 167, 69, 0.1);
  color: var(--success);
  border: 1px solid var(--success);
}

.alert-danger {
  background: rgba(220, 53, 69, 0.1);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.alert-info {
  background: rgba(121, 58, 128, 0.1);
  color: var(--primary);
  border: 1px solid var(--primary);
}

.alert-warning {
  background: rgba(255, 193, 7, 0.1);
  color: var(--warning);
  border: 1px solid var(--warning);
}

.alert-primary {
  background: rgba(121, 58, 128, 0.1);
  color: var(--primary);
  border: 1px solid var(--primary);
}

/* Responsive adjustments for alerts */
@media (max-width: 576px) {
  .alert {
    padding: 0.875rem;
    font-size: 0.9rem;
  }

  .alert .btn {
    width: 100%;
    margin-top: 0.25rem;
  }
}

/* Badges */
.badge {
  padding: 0.35rem 0.65rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
}

.badge-success { background: var(--success); color: white; }
.badge-warning { background: var(--warning); color: #000; }
.badge-danger { background: var(--danger); color: white; }
.badge-info { background: var(--info); color: white; }
.badge-primary { background: var(--primary); color: white; }

/* Sidebar (Desktop) */
.sidebar {
  display: none;
  width: 260px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  position: fixed;
  top: 60px; /* altura del header */
  left: 0;
  bottom: 0;
  z-index: 900;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
}

.sidebar-header {
  padding: 1.5rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-avatar {
  width: 80px;
  height: 80px;
  margin: 0 auto 0.75rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 3rem;
}

.sidebar-nav {
  padding: 1rem 0;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}

.sidebar-item i {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
}

.sidebar-item span {
  font-size: 0.9375rem;
  font-weight: 500;
}

.sidebar-item:hover {
  background: var(--bg-secondary);
  color: var(--primary);
}

.sidebar-item.active {
  background: rgba(121, 58, 128, 0.1);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}

.sidebar-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.sidebar-item.disabled:hover {
  background: transparent;
  color: var(--text-primary);
}

/* Responsive */
@media (min-width: 768px) {
  .bottom-nav {
    display: none;
  }

  .sidebar {
    display: block;
  }

  .app-container {
    flex-direction: row;
  }

  #pantallas-capa {
    margin-bottom: 0;
    margin-left: 260px; /* ancho del sidebar */
    min-height: calc(100vh - 60px); /* 100vh - header */
  }

  .screen-controls {
    bottom: 1rem;
    right: calc(1rem); /* ajuste para sidebar */
  }

  .page-indicator {
    bottom: 1rem;
    left: calc(260px + 1rem); /* sidebar + margen */
  }
}

@media (max-width: 576px) {
  .login-card {
    border-radius: 0;
  }

  .panel-card {
    padding: 1rem;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Animaciones de entrada */
.fade-in {
  animation: fadeIn 0.3s ease-in;
}

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

/* Utilidades */
.text-primary { color: var(--primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.bg-primary { background: var(--primary) !important; }
.border-primary { border-color: var(--primary) !important; }

.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.justify-content-between { justify-content: space-between !important; }
.align-items-center { align-items: center !important; }
.gap-1 { gap: 0.5rem !important; }
.gap-2 { gap: 1rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.p-0 { padding: 0 !important; }
.px-2 { padding-left: 0.5rem !important; padding-right: 0.5rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.w-100 { width: 100% !important; }
.text-center { text-align: center !important; }
.text-end { text-align: right !important; }
.fw-bold { font-weight: 700 !important; }
.rounded { border-radius: 0.5rem !important; }
