
/* ============================================
   VARIABLES CSS - PALETA DE COLORES MODERNA
   ============================================ */
:root {
  /* Colores principales */
  --primary-color: #2563eb;
  --primary-dark: #1e40af;
  --primary-light: #3b82f6;
  --primary-lighter: #dbeafe;
  
  /* Colores secundarios */
  --secondary-color: #10b981;
  --secondary-dark: #059669;
  --secondary-light: #34d399;
  
  /* Colores de estado */
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --success-color: #10b981;
  --info-color: #0ea5e9;
  
  /* Grises y neutros */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  /* Fondos */
  --main-bg-color: #f8fafc;
  --second-bg-color: #f1f5f9;
  --card-bg-color: #ffffff;
  --sidebar-bg-color: #ffffff;
  
  /* Textos */
  --main-text-color: #1f2937;
  --second-text-color: #6b7280;
  --light-text-color: #9ca3af;
  --white-text: #ffffff;
  
  /* Sombras y efectos */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  
  /* Bordes */
  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 12px;
  --border-radius-xl: 16px;
  
  /* Espaciado */
  --spacing-unit: 8px;
  
  /* Transiciones */
  --transition-fast: 0.15s ease-in-out;
  --transition-normal: 0.25s ease-in-out;
  --transition-slow: 0.4s ease-in-out;
}

/* ============================================
   RESET Y ESTILOS GLOBALES
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--main-text-color);
  background-color: var(--main-bg-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   TIPOGRAFÍA
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
  margin-bottom: 1rem;
  color: var(--second-text-color);
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-dark);
}

/* ============================================
   LAYOUT PRINCIPAL (SIDEBAR + CONTENT)
   ============================================ */
#wrapper {
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  background: linear-gradient(135deg, var(--main-bg-color) 0%, var(--second-bg-color) 100%);
}

#sidebar-wrapper {
  position: relative;
  width: 260px;
  min-height: 100vh;
  background: var(--sidebar-bg-color);
  box-shadow: var(--shadow-md);
  margin-left: -260px;
  transition: margin-left var(--transition-normal);
  z-index: 1000;
  overflow-y: auto;
}

#sidebar-wrapper.show {
  margin-left: 0;
}

#page-content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
}

#wrapper.toggled #sidebar-wrapper {
  margin-left: 0;
}

/* Sidebar Heading */
#sidebar-wrapper .sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--spacing-unit) * 2.5);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--white-text);
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  border-bottom: 1px solid var(--primary-dark);
  gap: 0.5rem;
}

#sidebar-wrapper .sidebar-heading i {
  font-size: 1.5rem;
}

/* Menu Items */
#sidebar-wrapper .list-group {
  width: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.list-group-item {
  background-color: transparent;
  border: none;
  border-left: 4px solid transparent;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--second-text-color);
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
  display: flex;
  align-items: center;
  white-space: nowrap;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-group-item:hover {
  background-color: var(--primary-lighter);
  color: var(--primary-color);
  border-left-color: var(--primary-color);
  padding-left: 1.5rem;
  border-radius: var(--border-radius-md);
}

.list-group-item.active {
  background-color: var(--primary-lighter);
  color: var(--primary-color);
  border-left-color: var(--primary-color);
  font-weight: 600;
  padding-left: 1.5rem;
  border-radius: var(--border-radius-md);
}

.list-group-item i {
  width: 24px;
  text-align: center;
  margin-right: 0.75rem;
  flex-shrink: 0;
}

.list-group-item span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar Logout Section */
.sidebar-logout-section {
  border-top: 2px solid var(--gray-200);
  margin-top: auto;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.sidebar-logout-section .list-group-item {
  margin-bottom: 0;
  color: var(--danger-color);
}

.sidebar-logout-section .list-group-item:hover {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
  border-left-color: var(--danger-color);
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
  background: var(--card-bg-color) !important;
  box-shadow: var(--shadow-md);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 999;
  padding: 0 !important;
  min-height: 70px;
}

.navbar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  padding: 1.25rem 2rem;
  gap: 1.5rem;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-shrink: 0;
}

.navbar-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  white-space: nowrap;
  margin: 0;
  display: none;
}

.navbar-logo.show {
  display: block;
}

.navbar-spacer {
  flex: 1;
}

.navbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  flex-shrink: 0;
}

.btn-menu-toggle {
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--primary-color);
  transition: all var(--transition-fast);
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-md);
  width: 45px;
  height: 45px;
  border: 1px solid var(--gray-200);
  background: transparent;
  cursor: pointer;
}

.btn-menu-toggle:hover {
  color: var(--primary-dark);
  background-color: var(--primary-lighter);
  border-color: var(--primary-lighter);
}

/* User Dropdown */
.user-dropdown {
  position: relative;
}

.user-button {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  color: var(--second-text-color);
  font-weight: 500;
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.user-button:hover {
  background-color: var(--primary-lighter);
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.user-button i {
  font-size: 1.5rem;
  margin-right: 0.25rem;
}

.user-name {
  white-space: nowrap;
  text-decoration: none;
  color: inherit;
}

.dropdown-user-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--card-bg-color);
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  margin-top: 0.5rem;
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--transition-fast);
  pointer-events: none;
}

.dropdown-user-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  color: var(--main-text-color);
  text-decoration: none;
  transition: all var(--transition-fast);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
}

.dropdown-item:hover {
  background-color: var(--primary-lighter);
  color: var(--primary-color);
  padding-left: 1.5rem;
}

.dropdown-item.danger {
  color: var(--danger-color);
}

.dropdown-item.danger:hover {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
}

.dropdown-item i {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.dropdown-divider {
  height: 1px;
  background-color: var(--gray-200);
  margin: 0.5rem 0;
}

/* ============================================
   NAVBAR - RESPONSIVE
   ============================================ */
@media (min-width: 768px) {
  .navbar-logo {
    display: block;
  }
  
  .user-button {
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }
}

@media (max-width: 991px) {
  .navbar-container {
    padding: 1rem 1.5rem;
  }
  
  .navbar-left {
    gap: 1rem;
  }
}

@media (max-width: 767px) {
  .navbar {
    min-height: 60px;
  }
  
  .navbar-container {
    padding: 0.75rem 1rem;
  }
  
  .navbar-logo {
    display: none;
  }
  
  .navbar-left,
  .navbar-right {
    gap: 0.75rem;
  }
  
  .user-button {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }
  
  .user-button i {
    font-size: 1.25rem;
  }
  
  .user-name {
    display: none;
  }
  
  .dropdown-user-menu {
    min-width: 180px;
  }
}

@media (max-width: 479px) {
  .navbar {
    min-height: 55px;
  }
  
  .navbar-container {
    padding: 0.5rem 0.75rem;
  }
  
  .btn-menu-toggle {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }
  
  .user-button {
    padding: 0.4rem 0.6rem;
  }
}

/* ============================================
   CONTENIDO PRINCIPAL
   ============================================ */
.content-wrapper {
  flex: 1;
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.content-wrapper .row {
  margin-bottom: 2rem;
}

.content-wrapper [class*='col-'] {
  padding-bottom: 1.5rem;
}

.content-wrapper [class*='col-'] .card {
  margin-bottom: 0;
}

.page-title {
  display: flex;
  align-items: center;
  margin-bottom: 2rem;
  font-size: 2rem;
  font-weight: 700;
  color: var(--gray-900);
}

.page-title i {
  margin-right: 1rem;
  color: var(--primary-color);
  font-size: 2.25rem;
}

/* ============================================
   TARJETAS (CARDS)
   ============================================ */
.card {
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  background-color: var(--card-bg-color);
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--gray-300);
}

.card-header {
  background: linear-gradient(135deg, var(--primary-lighter) 0%, rgba(219, 234, 254, 0.5) 100%);
  border-bottom: 1px solid var(--gray-200);
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  padding: 1.5rem;
}

.card-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-title {
  color: var(--gray-900);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.card-text {
  color: var(--second-text-color);
  font-size: 0.95rem;
}

/* ============================================
   BOTONES
   ============================================ */
.btn {
  font-weight: 600;
  border-radius: var(--border-radius-md);
  padding: 0.75rem 1.5rem;
  transition: all var(--transition-fast);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1rem;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn:active {
  transform: scale(0.98);
}

.btn i {
  font-size: 1.1rem;
}

/* Primary Button */
.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: var(--white-text);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, #1d3a8a 100%);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

/* Secondary Button */
.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-900);
  border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
  background: var(--gray-300);
  border-color: var(--gray-400);
  box-shadow: var(--shadow-sm);
}

/* Danger Button */
.btn-danger {
  background: var(--danger-color);
  color: var(--white-text);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.35);
  transform: translateY(-2px);
}

.btn-danger:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

/* Success Button */
.btn-success {
  background: var(--success-color);
  color: var(--white-text);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
  background: var(--secondary-dark);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
  transform: translateY(-2px);
}

.btn-success:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

/* Button Sizes */
.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-sm i {
  font-size: 0.9rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

.btn-lg i {
  font-size: 1.3rem;
}

/* Disabled State */
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
}

/* ============================================
   FORMULARIOS
   ============================================ */
.form-control,
.form-select,
textarea.form-control {
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius-md);
  padding: 0.625rem 0.875rem;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  color: var(--main-text-color);
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  outline: none;
}

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

.form-label {
  color: var(--gray-900);
  font-weight: 500;
  margin-bottom: 0.5rem;
  display: block;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.form-group {
  margin-bottom: 1.5rem;
}

/* ============================================
   TABLAS
   ============================================ */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

table thead th {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: var(--white-text);
  font-weight: 600;
  padding: 1.25rem;
  text-align: left;
  border: none;
}

table tbody tr {
  border-bottom: 1px solid var(--gray-200);
  transition: background-color var(--transition-fast);
}

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

table tbody tr:hover {
  background-color: var(--gray-50);
}

table td {
  padding: 1rem 1.25rem;
  color: var(--main-text-color);
}

/* ============================================
   ALERTAS Y MENSAGENS
   ============================================ */
.alert {
  border-radius: var(--border-radius-lg);
  border: none;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.alert-info {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.1), rgba(14, 165, 233, 0.1));
  color: var(--info-color);
  border-left: 4px solid var(--info-color);
}

.alert-success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(52, 211, 153, 0.1));
  color: var(--success-color);
  border-left: 4px solid var(--success-color);
}

.alert-warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(251, 191, 36, 0.1));
  color: var(--warning-color);
  border-left: 4px solid var(--warning-color);
}

.alert-danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(248, 113, 113, 0.1));
  color: var(--danger-color);
  border-left: 4px solid var(--danger-color);
}

.alert-close {
  cursor: pointer;
  font-weight: bold;
  font-size: 1.25rem;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: 20px;
  font-weight: 500;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.badge-primary {
  background: var(--primary-lighter);
  color: var(--primary-color);
}

.badge-secondary {
  background: var(--gray-200);
  color: var(--gray-700);
}

.badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
}

/* ============================================
   UTILITARIOS
   ============================================ */
.primary-text {
  color: var(--primary-color);
}

.second-text {
  color: var(--second-text-color);
}

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

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

.rounded-full {
  border-radius: 50%;
}

.special-card {
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Espaciado personalizado */
.gap-md { gap: 1.5rem; }
.gap-lg { gap: 2rem; }
.gap-xl { gap: 3rem; }

/* ============================================
   FOOTER
   ============================================ */
.footer {
  background: var(--card-bg-color);
  border-top: 1px solid var(--gray-200);
  padding: 2rem 1.5rem;
  margin-top: auto;
  text-align: center;
  color: var(--second-text-color);
  font-size: 0.95rem;
}

/* ============================================
   RESPONSIVE - TABLET (768px y arriba)
   ============================================ */
@media (min-width: 768px) {
  h1 { font-size: 2.5rem; }
  h2 { font-size: 2rem; }
  
  #sidebar-wrapper {
    margin-left: 0;
  }
  
  #page-content-wrapper {
    width: auto;
    flex: 1;
  }
  
  #wrapper.toggled #sidebar-wrapper {
    margin-left: -260px;
  }
  
  .content-wrapper {
    padding: 2.5rem;
  }
}

/* ============================================
   RESPONSIVE - MOBILE (menos de 768px)
   ============================================ */
@media (max-width: 767px) {
  body {
    font-size: 13px;
  }
  
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  
  .content-wrapper {
    padding: 1.5rem;
  }
  
  .page-title {
    font-size: 1.5rem;
  }
  
  .page-title i {
    font-size: 1.75rem;
  }
  
  .card {
    margin-bottom: 1rem;
  }
  
  .btn {
    width: 100%;
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
  }
  
  .btn-sm {
    width: auto;
    padding: 0.5rem 1rem;
  }
  
  .form-control,
  .form-select,
  textarea.form-control {
    font-size: 16px;
  }
  
  table {
    font-size: 0.85rem;
  }
  
  table th,
  table td {
    padding: 0.75rem 0.5rem;
  }
  
  .row {
    margin-left: 0;
    margin-right: 0;
  }
  
  [class*='col-'] {
    padding-left: 0;
    padding-right: 0;
    margin-bottom: 1rem;
  }
}

/* ============================================
   RESPONSIVE - EXTRA SMALL (menos de 480px)
   ============================================ */
@media (max-width: 479px) {
  .navbar {
    padding: 0.75rem 1rem !important;
    min-height: 55px;
  }
  
  .content-wrapper {
    padding: 1rem;
  }
  
  .page-title {
    font-size: 1.25rem;
  }
  
  .page-title i {
    font-size: 1.5rem;
    margin-right: 0.5rem;
  }
  
  .btn {
    width: 100%;
    font-size: 0.95rem;
    padding: 0.65rem 1rem;
  }
  }
  
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.1rem; }
}

/* ============================================
   UTILITARIOS ADICIONALES
   ============================================ */
.container-fluid {
  padding: 0;
}

.text-center {
  text-align: center;
}

.text-muted {
  color: var(--light-text-color);
}

.opacity-50 {
  opacity: 0.5;
}

.opacity-75 {
  opacity: 0.75;
}

.shadow-none {
  box-shadow: none;
}

.transition-all {
  transition: all var(--transition-normal);
}