:root {
  --primary-gradient: linear-gradient(135deg, #0d6efd, #0a58ca);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Fondo pantalla de inicio de sesión */
.body-login {
  background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 35%, #3a7ca5 70%, #4a9fd1 100%);
  background-attachment: fixed;
  position: relative;
}
.body-login::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}
.body-login .container {
  position: relative;
  z-index: 1;
}
.card-login {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
}
.body-login .text-muted {
  color: rgba(255, 255, 255, 0.9) !important;
}

/* Fondo área principal (después de ingresar) */
.body-app {
  background: linear-gradient(180deg, #e8eef4 0%, #d4dde8 50%, #c5d1e0 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Saludo de bienvenida */
.welcome-banner {
  background: linear-gradient(90deg, #0d6efd, #0a58ca);
  color: #fff;
  padding: 0.6rem 0;
  margin: -1rem -0.5rem 1rem -0.5rem;
  border-radius: 0 0 0.5rem 0.5rem;
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.25);
}
.welcome-banner .welcome-text {
  font-size: 1.05rem;
  font-weight: 500;
}
.welcome-banner .welcome-date {
  font-size: 0.85rem;
  opacity: 0.9;
}
.alert-welcome {
  border-left: 4px solid #0d6efd;
  background: linear-gradient(90deg, rgba(13, 110, 253, 0.08), transparent);
}

/* Menú lateral izquierdo */
.app-layout {
  min-height: 100vh;
}
.sidebar {
  width: 240px;
  min-width: 240px;
  background: linear-gradient(180deg, #212529 0%, #343a40 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 12px rgba(0,0,0,0.15);
}
.sidebar-brand {
  padding: 1.25rem 1rem;
  font-weight: 700;
  font-size: 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sidebar-brand i {
  font-size: 1.5rem;
  color: #0d6efd;
}
.sidebar-nav {
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}
.sidebar .btn-menu {
  text-align: left;
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.06);
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}
.sidebar .btn-menu:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.sidebar .btn-menu.btn-salir {
  color: #f8a5a5;
}
.sidebar .btn-menu.btn-salir:hover {
  background: rgba(220, 53, 69, 0.3);
  color: #fff;
}
.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sidebar-user {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.75);
  padding: 0 0.5rem;
}
.main-content {
  overflow-x: auto;
  min-width: 0;
}

/* Botón hamburguesa (solo móvil/tablet) */
.sidebar-toggle {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1030;
  width: 44px;
  height: 44px;
  border-radius: 0.5rem;
  border: none;
  background: #212529;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.sidebar-toggle:hover {
  background: #343a40;
  color: #fff;
}
.sidebar-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  padding: 0.25rem;
  font-size: 1.25rem;
}
.sidebar-close:hover {
  color: #fff;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1025;
  opacity: 0;
  transition: opacity 0.25s;
}
body.sidebar-open .sidebar-overlay {
  display: block;
  opacity: 1;
}

/* Responsive: menú lateral en móvil */
@media (max-width: 991.98px) {
  .app-layout {
    flex-direction: column;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    min-width: 260px;
    z-index: 1030;
    transform: translateX(-100%);
    transition: transform 0.25s ease-out;
    box-shadow: 4px 0 20px rgba(0,0,0,0.2);
  }
  body.sidebar-open .sidebar {
    transform: translateX(0);
  }
  .main-content {
    width: 100%;
    padding-top: 3.5rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .sidebar-brand {
    padding-right: 0.5rem;
  }
}
@media (min-width: 992px) {
  .sidebar-toggle,
  .sidebar-close,
  .sidebar-overlay {
    display: none !important;
  }
}

/* Responsive: contenido general */
@media (max-width: 767.98px) {
  .welcome-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.5rem 0.75rem;
  }
  .welcome-banner .welcome-text {
    font-size: 0.95rem;
  }
  .welcome-banner .welcome-date {
    font-size: 0.8rem;
  }
  .container {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  .card-body {
    padding: 1rem !important;
  }
  .btn-lg {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  .table {
    font-size: 0.8rem;
  }
  .table th, .table td {
    padding: 0.35rem;
    white-space: nowrap;
  }
  .d-flex.gap-2 {
    flex-wrap: wrap;
  }
  .card-header.d-flex {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

.navbar-brand {
  font-size: 1.4rem;
  letter-spacing: 1px;
}

.card {
  border-radius: 0.75rem;
  overflow: hidden;
}

.card-header {
  border-bottom: none;
}

.form-control:focus,
.form-select:focus {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.login-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8f0fe, #d4e5fd);
  display: flex;
  align-items: center;
  justify-content: center;
}

.table th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-lg {
  border-radius: 0.5rem;
}

.alert {
  border-radius: 0.5rem;
}

.badge {
  font-weight: 500;
}

.personal-input {
  border-right: 0;
}

.btn-add-personal,
.btn-remove-personal {
  border-radius: 0 0.375rem 0.375rem 0 !important;
}

@media print {
  .sidebar, .navbar, footer, .btn, form, .no-print {
    display: none !important;
  }
  .main-content {
    margin: 0 !important;
  }
  .card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
}
