/* Base Styles */
:root {
  /* Colores principales */
  --primary: #474fd5;
  --primary-dark: #142e49;
  --primary-hover: #3a40b0;
  --primary-active: #2d3288;
  --secondary: #6c757d;
  --success: #198754;
  --info: #12c5e9f5;
  --warning: #ffc107;
  --danger: #dc3545;
  
  /* Colores de bancos */
  --bcp-color: #ff6600;
  --bbva-color: #00278f;
  
  /* Escala de grises */
  --light: #f8f9fa;
  --dark: #212529;
  --gray-100: #f8f9fa;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #6c757d;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;
  
  /* Variables para compatibilidad */
  --primary-color: var(--primary);
  --secondary-color: var(--secondary);
  --success-color: var(--success);
  --danger-color: var(--danger);
  --warning-color: var(--warning);
  --info-color: var(--info);
  --light-color: var(--light);
  --dark-color: var(--dark);
  
  /* Componentes */
  --navbar-height: 56px;
  --navbar-padding: 0.25rem 0;
  /* Sombras */
  --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
  
  /* Bordes */
  --radius: 0.375rem;
  --radius-sm: 0.25rem;
  --radius-lg: 0.5rem;
  
  /* Transiciones */
  --transition: all 0.2s ease-in-out;

  /* Otros */
  --logo-height: 55px;
  --logo-width: 150px;
}

/* Estilos de la barra de navegación */
.navbar {
  --bs-navbar-padding-y: 0.25rem;
  min-height: var(--navbar-height);
  max-height: var(--navbar-height);
  background-color: var(--primary) !important;
  margin-bottom: 5px !important;
}

.navbar-brand {
  padding: 0.25rem 0;
  display: flex;
  align-items: center;
}

.navbar-brand img {
  height: var(--logo-height) !important;
  width: auto !important;
  max-height: var(--logo-height) !important;
  max-width: var(--logo-width) !important;
  object-fit: contain;
  margin-right: 0.5rem;
  display: block;
}

.img-frame {
  max-width: var(--logo-width);
  height: calc(var(--logo-height) - 7px);
  overflow: hidden;
}

.img-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

/* Estilos de botones */
.btn-primary {
  background-color: var(--primary);
  border-color: var(--primary-hover);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-active);
}

.btn-primary:active {
  background-color: var(--primary-active) !important;
  border-color: var(--primary-active) !important;
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Asap', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif, 'Open Sans';
  line-height: 1.6;
  color: var(--gray-800);
  background-color: var(--gray-100);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

h1 { font-size: 2rem; }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.2rem; }
h5 { font-size: 1rem; }
h6 { font-size: 1rem; }

p {
  margin-bottom: 1rem;
}

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

a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Layout */
.container {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 1rem;
}

.spinner-border {
  margin-right: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-family: 'Asap', sans-serif;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: var(--transition);
}

.btn:focus {
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.btn:disabled,
.btn.disabled {
  opacity: 0.65;
  pointer-events: none;
}

/* Button Sizes */
.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.5rem 1.5rem;
  font-size: 1.25rem;
  border-radius: var(--radius-lg);
}

/* Button Variants */
.btn-primary {
  color: #fff;
  background-color: var(--primary);
  border-color: var(--primary);
}

.btn-primary:hover {
  color: #fff;
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-outline-primary {
  color: var(--primary);
  border: 1px solid var(--primary);
  background-color: transparent;
}

.btn-outline-primary:hover {
  color: #fff;
  background-color: var(--primary);
  border-color: var(--primary);
}

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

/* Header */
.header {
  background: white;
  box-shadow: var(--shadow);
  padding: 15px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  font-family: 'Asap', sans-serif;
}

/* Auth Pages */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 70vh;
  padding: 40px 0;
}

.auth-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  width: 100%;
  max-width: 500px;
  margin: 0 20px;
}

/* Cards */

.card-header {
  background-color: var(--primary) !important;
  color: white !important;
  padding: 10px 20px;
}

.card-header p {
  color: white !important;
}

.card-header h4 {
  color: white !important;
}

.card-body {
  padding: 25px 16px 20px 16px;
}

.bg-info {
  background-color: var(--info) !important;
  color: #ffffffe8 !important;
}

/* Dashboard */
.dashboard {
  padding: 20px 0;
}

/* Tables */

table {
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 6px;
  overflow: hidden;
}

.table thead th {
  background-color: var(--primary-dark) !important;
  color: white !important;
  text-align: center;
}
.table td {
  text-align: center;
}

/* File Upload */
.file-upload-area {
  border: 2px dashed #e0e0e0;
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  margin-bottom: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.file-upload-area:hover {
  border-color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
  .header .container {
    flex-direction: column;  position: absolute;
  right: 8px;

    gap: 15px;
  }
  
  .auth-card {
    padding: 20px;
  }
}

/* Commission Toggle Button - Updated Styles */
.commission-toggle {
  width: 20px;
  height: 20px;
  padding: 4px;
  background-color: transparent;
  border: none;
  color: #6c757d;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 2px; /* Reducido para mantener más cerca del número */
  margin-right: 8px;
  vertical-align: baseline;
  position: absolute;
  right: 0; /* Posiciona el botón al extremo derecho del contenedor */
  transform: translateX(50%); /* Mueve el botón hacia la derecha para que no afecte la alineación */
}

.commission-toggle:hover {
  background-color: transparent;
  border: none;
  color: #4a4a4a;
  transform: translateX(50%) scale(1.1);
}

.commission-toggle:focus {
  outline: none;
  box-shadow: none;
}

.commission-toggle i {
  font-size: 12px;
  transition: transform 0.3s ease;
  line-height: 1;
  color: inherit;
}

.commission-toggle.active {
  background-color: transparent;
  border: none;
  color: #4a4a4a;
}

.commission-toggle.active:hover {
  color: #2a2a2a;
  transform: translateX(50%) scale(1.1);
}

.commission-toggle.active i {
  transform: rotate(180deg);
}

/* Pago Total column styling - Updated for proper alignment */
.pago-total-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  position: relative;
}

.pago-total-amount {
  display: inline-block;
  text-align: center;
  margin-right: 8px;
  font-size: 14.5px;
}

/* Make button icon style consistent */
.btn-icon {
  background: transparent;
  border: none;
  padding: 4px;
}

.btn-icon:focus {
  box-shadow: none;
}

/* Commission breakdown styling */
.commission-breakdown-list {
    max-width: 100%;
}

.commission-item {
    padding: 4px 0;
}

.commission-item:last-of-type {
    border-bottom: none !important;
}

.commission-concept {
    color: #495057;
    font-size: 14px;
}

.commission-amount {
    color: var(--primary) !important;
    font-size: 14px;
}

.commission-total {
    background-color: #f8f9fa;
    padding: 12px 0 !important;
    margin-top: 8px !important;
    border-top: 2px solid var(--success) !important;
}

/* Commission detail row styling */
.commission-detail-row {
    background-color: #f8f9fa;
}

.commission-detail-row .bg-light {
    background-color: #ffffff !important;
    padding: 2px !important;
    /* border: 1px solid #e9ecef;
    border-radius: 8px;
    margin: 8px; */
}

/* Limit width of commission detail content */
.commission-detail-row td {
    padding: 0 !important;
}

.commission-detail-content {
    max-width: 80%;
    margin: 0 auto;
    padding: 2px 12px;
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.activacion-usuario-row td {
    padding: 12px 8px !important;
    vertical-align: middle;
}

.fas {
    margin-right: 6px;
}

.badge {
    font-size: 12px;
}

.col-md-6 {
    padding-top: 8px;
    padding-left: 16px !important;
}

h6.text-muted.mb-3 {
    margin-bottom: 10px !important;
}

.attendance-event {
    font-size: 13px !important;
}

.attendance-event-name {
    font-size: 13px !important;
}

.attendance-time {
    font-size: 13px !important;
    font-weight: bold !important;
}

.attendance-date {
    font-size: 14px !important;
    font-weight: bold !important;
    text-align: left !important;
    margin-bottom: 2px !important;
}

.col-md-6:first-child {
    padding-right: 20px !important;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  /* Reduce container padding on mobile */
  .container {
    padding: 0 0.5rem;
  }
  
  /* Make card take full width with minimal margin */
  .card {
    margin: 0 0.25rem;
    border-radius: var(--radius-sm);
  }
  
  /* Reduce card padding */
  .card-body {
    padding: 15px 8px 15px 8px;
  }
  
  /* Table responsive improvements */
  .table-responsive {
    margin: -8px; /* Negative margin to use card padding space */
    padding: 0;
    border-radius: 0;
  }
  
  /* Table cell padding optimization */
  .table td, .table th {
    padding: 8px 4px;
    font-size: 0.875rem;
    line-height: 1.3;
  }
  
  /* Specific column optimizations for mobile */
  .table th:nth-child(1), .table td:nth-child(1) { /* Sede */
    min-width: 80px;
  }
  
  .table th:nth-child(2), .table td:nth-child(2), /* Inicio */
  .table th:nth-child(3), .table td:nth-child(3) { /* Fin */
    min-width: 65px;
    font-size: 0.75rem;
  }
  
  .table th:nth-child(4), .table td:nth-child(4) { /* Código Cupón */
    min-width: 80px;
  }
  
  .table th:nth-child(5), .table td:nth-child(5) { /* Tipo */
    min-width: 60px;
    font-size: 0.75rem;
  }
  
  .table th:nth-child(6), .table td:nth-child(6) { /* Estado */
    min-width: 85px;
  }
  
  .table th:nth-child(7), .table td:nth-child(7) { /* Pago Total */
    min-width: 90px;
  }
  
  .table th:nth-child(8), .table td:nth-child(8) { /* Suspensión */
    min-width: 85px;
  }
  
  .table th:nth-child(9), .table td:nth-child(9) { /* Acciones */
    min-width: 80px;
  }
  
  /* Mobile-specific Pago Total styling */
  .pago-total-wrapper {
    flex-direction: column;
    gap: 4px;
    position: relative;
  }
  
  .commission-toggle {
    position: static;
    transform: none;
    margin-left: 0;
    margin-top: 2px;
  }
  
  .commission-toggle:hover {
    transform: scale(1.1);
  }
  
  .commission-toggle.active:hover {
    transform: scale(1.1);
  }
  
  /* Badge adjustments for mobile */
  .badge {
    font-size: 0.7rem;
    padding: 0.25em 0.4em;
  }
  
  /* Button adjustments for mobile */
  .btn-sm {
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
  }
  
  /* Upload button specific */
  .upload-btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
  }
  
  .upload-btn i {
    font-size: 0.7rem;
    margin-right: 0.25rem;
  }
  
  /* Commission detail row mobile optimization */
  .commission-detail-content {
    max-width: 95%;
    margin: 0 auto;
    padding: 8px;
    margin-top: 4px;
    margin-bottom: 4px;
  }
  
  .commission-breakdown-list {
    font-size: 0.875rem;
  }
  
  .commission-item {
    padding: 2px 0;
  }
  
  .commission-concept {
    font-size: 0.8rem;
  }
  
  .commission-amount {
    font-size: 0.8rem;
  }
}

/* Extra small devices optimization */
@media (max-width: 576px) {
  .container {
    padding: 0 0.25rem;
  }
  
  .card {
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  
  .card-body {
    padding: 10px 4px;
  }
  
  .table-responsive {
    margin: -4px;
  }
  
  .table td, .table th {
    padding: 6px 2px;
    font-size: 0.8rem;
  }
  
  /* Even smaller text for date columns */
  .table th:nth-child(2), .table td:nth-child(2),
  .table th:nth-child(3), .table td:nth-child(3) {
    font-size: 0.7rem;
  }
  
  /* Compact badges for very small screens */
  .badge {
    font-size: 0.65rem;
    padding: 0.2em 0.3em;
  }
  
  .upload-btn {
    padding: 0.25rem 0.4rem;
    font-size: 0.7rem;
  }
}

/* Profile Page Styles */
.profile-container {
  margin-top: 0.5rem;
}

.profile-title {
  text-align: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #f8f9fa;
}

.profile-title h2 {
  color: #474fd5 !important;
  font-weight: 600;
  margin-bottom: 0;
}

.profile-title i {
  color: #474fd5 !important;
}

.profile-section {
  margin-bottom: 3rem;
}

.profile-subtitle {
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e9ecef;
}

.profile-subtitle h4 {
  color: #474fd5 !important;
  font-weight: 600;
  margin-bottom: 0;
}

.profile-subtitle i {
  color: #474fd5 !important;
}

.profile-content {
  background-color: #f8f9fa;
  padding: 1.5rem;
  border-radius: 0.5rem;
  border-left: 4px solid #474fd5;
}

.profile-field {
  margin-bottom: 1rem;
}

.profile-field-label {
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: block;
}

.profile-field-value {
  background-color: transparent;
  border: none;
  padding: 0.375rem 0;
  color: #212529;
  display: block;
  width: 100%;
}

.profile-no-data {
  color: #0c5460;
  background-color: #d1ecf1;
  border-color: #bee5eb;
  padding: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-radius: 0.375rem;
}

.profile-actions {
  margin-top: 2rem;
  display: flex;
  gap: 0.5rem;
}

.profile-refresh-btn {
  color: #474fd5;
  border-color: #474fd5;
  background-color: transparent;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  border-radius: 0.375rem;
  border: 1px solid #474fd5;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
}

.profile-refresh-btn:hover {
  color: white;
  background-color: #474fd5;
  border-color: #474fd5;
}

.profile-back-btn {
  color: white;
  background-color: #6c757d;
  border-color: #6c757d;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  border-radius: 0.375rem;
  border: 1px solid #6c757d;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
}

.profile-back-btn:hover {
  color: white;
  background-color: #5c636a;
  border-color: #565e64;
}

/* Bank badges */
.bank-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.375rem;
  color: white;
}

.bank-badge.bcp {
  background-color: var(--bcp-color);
}

.bank-badge.bbva {
  background-color: var(--bbva-color);
}

/* Base Layout Styles */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

html {
  overflow-x: hidden;
}

.main-content {
  flex: 1;
  padding: 2rem 0;
}

.toast {
  margin-bottom: 1rem;
}

/* Navbar fixes for mobile */
.navbar {
  padding: 0.5rem 0;
}

/* Fix navbar container alignment for mobile */
@media (max-width: 991.98px) {
  .navbar .container-fluid {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
  
  .navbar {
    padding: 0 0 0.25rem 0;
  }
  
  /* Fix navbar-collapse visibility */
  .navbar-collapse {
    background-color: rgba(116, 125, 213, 0.95);
    margin: 0 -1rem 0 -1rem;
    padding: 1rem;
    border-radius: 0 0 0.375rem 0.375rem;
    position: relative;
    z-index: 1030;
  }
  
  .navbar-nav .nav-link {
    color: white !important;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  
  .navbar-nav .nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    color: white !important;
  }
  
  .navbar-nav .nav-link i {
    color: white !important;
  }
}

.navbar-nav .dropdown-menu {
  border: 1px solid rgba(0,0,0,.15);
  box-shadow: 0 0.5rem 1rem rgba(0,0,0,.15);
}

/* Fix navbar toggler alignment */
.navbar-toggler {
  padding: 0.25rem 0.5rem;
  border: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.navbar-toggler-icon {
  width: 1.5em;
  height: 1.5em;
  vertical-align: middle;
}

/* Fix dropdown toggle alignment */
.navbar-nav .nav-link.dropdown-toggle {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
}

@media (max-width: 991.98px) {
  .navbar-collapse.collapse:not(.show) {
    display: none;
  }
  
  .navbar-collapse.collapse.show {
    display: block !important;
  }
  
  .navbar-nav .dropdown-menu {
    position: static !important;
    transform: none !important;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    background-color: rgba(255,255,255,0.95);
    margin-top: 0.5rem;
    display: none !important;
    border-radius: 0.375rem;
  }
  
  .navbar-nav .dropdown-menu.show {
    display: block !important;
  }
  
  .navbar-nav .dropdown-item {
    color: #333 !important;
    padding: 0.5rem 1rem;
    font-weight: 500;
  }
  
  .navbar-nav .dropdown-item:hover,
  .navbar-nav .dropdown-item:focus {
    background-color: rgba(116, 125, 213, 0.1);
    color: #474fd5 !important;
  }
  
  .navbar-nav .dropdown-item.text-danger {
    color: #dc3545 !important;
  }
  
  .navbar-nav .dropdown-item.text-danger:hover {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545 !important;
  }
  
  .navbar-nav .dropdown-divider {
    border-color: rgba(255,255,255,0.1);
  }
  
  /* Fix mobile dropdown toggle behavior */
  .navbar-nav .dropdown-toggle::after {
    display: none;
  }
  
  .navbar-nav .nav-link.dropdown-toggle {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
}