/* ===== COMPONENTES - CIMA ===== */

/* ============================================
   TARJETAS (CARDS)
   ============================================ */

.card {
  background-color: var(--color-bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border-light);
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
}

/* ============================================
   ALERTAS
   ============================================ */

.alert {
  background: linear-gradient(135deg, rgba(0, 86, 179, 0.1), rgba(0, 61, 122, 0.15));
  color: var(--color-text-primary);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  font-size: var(--font-size-sm);
  border-left: 4px solid var(--color-navy);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  animation: slideIn var(--transition-base);
}

.alert-persistent {
  background: linear-gradient(135deg, var(--color-navy-light), var(--color-navy));
  color: var(--color-white);
  border-left: 4px solid var(--color-white);
  font-weight: var(--font-weight-medium);
  box-shadow: var(--shadow-md);
}

@keyframes slideIn {
  from {
    transform: translateX(-20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ============================================
   ACTIVIDADES
   ============================================ */

.activity {
  margin-top: var(--space-md);
  padding: var(--space-md);
  border-top: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  background: var(--color-bg-card);
  transition: all var(--transition-base);
}

.activity:hover {
  background: var(--color-bg-hover);
  transform: translateX(4px);
}

.activity:first-child {
  margin-top: 0;
  border-top: none;
}

/* Estado de actividad */
.status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  margin: var(--space-sm) 0;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  border-radius: var(--radius-sm);
  background: var(--color-bg-hover);
  color: var(--color-text-secondary);
}

.status.enrolled {
  background: rgba(0, 86, 179, 0.15);
  color: var(--color-navy);
  font-weight: var(--font-weight-semibold);
}

/* ============================================
   BOTONES DE ACTIVIDAD
   ============================================ */

.btn-join,
.btn-skip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  margin-right: var(--space-sm);
  border-radius: var(--radius-md);
  border: none;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-join {
  background: var(--color-navy);
  color: var(--color-white);
  box-shadow: var(--shadow-sm);
}

.btn-join:hover {
  background: var(--color-navy-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.btn-join:active {
  transform: translateY(0);
}

.btn-join:disabled {
  background: var(--color-border-medium);
  color: var(--color-text-disabled);
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-skip {
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border-medium);
}

.btn-skip:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-border-dark);
  color: var(--color-text-primary);
}

/* ============================================
   PERFIL
   ============================================ */

.profile-card {
  background-color: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
  text-align: center;
  transition: all var(--transition-base);
}

.profile-card:hover {
  box-shadow: var(--shadow-card-hover);
}

/* Foto de perfil */
.profile-photo {
  position: relative;
  cursor: pointer;
  width: 120px;
  height: 120px;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 4px solid var(--color-navy);
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
}

.profile-photo:hover img {
  transform: scale(1.05);
  border-color: var(--color-navy-light);
}

/* Overlay de edición */
.edit-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 31, 63, 0.75);
  color: var(--color-white);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-base);
  backdrop-filter: blur(4px);
}

.profile-photo.editable:hover .edit-overlay,
.profile-photo:hover .edit-overlay {
  opacity: 1;
}

/* Información del perfil */
.profile-info {
  width: 100%;
}

.profile-info h2 {
  margin: 0 0 var(--space-md) 0;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
}

.profile-info p {
  margin-bottom: var(--space-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: var(--line-height-relaxed);
  text-align: left;
}

.profile-info p strong {
  color: var(--color-text-primary);
  font-weight: var(--font-weight-semibold);
  display: inline-block;
  min-width: 120px;
}

.profile-info p:last-child {
  margin-bottom: 0;
}

/* ============================================
   MODAL
   ============================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  animation: fadeIn var(--transition-base);
}

.modal.hidden {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Overlay del modal */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 31, 63, 0.8);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

/* Contenido del modal */
.modal-content {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--color-bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-modal);
  border: 1px solid var(--color-border-light);
  animation: slideUp var(--transition-base);
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-content h2 {
  margin: 0 0 var(--space-xl) 0;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
}

/* ============================================
   FORMULARIO DEL MODAL — CORREGIDO
   ============================================ */

.modal-content label {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
}

.modal-content input,
.modal-content select,
.modal-content textarea {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-medium);
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
  font-size: var(--font-size-base);
  transition: all var(--transition-base);
}

.modal-content input:focus,
.modal-content select:focus,
.modal-content textarea:focus {
  outline: none;
  border-color: var(--color-accent-light);
  box-shadow: 0 0 0 3px rgba(26, 127, 212, 0.15);
}

.modal-content input:hover,
.modal-content select:hover,
.modal-content textarea:hover {
  border-color: var(--color-border-dark);
}

/* Upload de foto */
.photo-upload input[type="file"] {
  padding: var(--space-xs);
  font-size: var(--font-size-sm);
  cursor: pointer;
  color: var(--color-text-primary);
}

.photo-upload input[type="file"]::file-selector-button {
  padding: var(--space-xs) var(--space-md);
  margin-right: var(--space-sm);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-medium);
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-base);
}

.photo-upload input[type="file"]::file-selector-button:hover {
  background: var(--color-bg-active);
  border-color: var(--color-border-dark);
}

/* Acciones del modal */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border-light);
}

.modal-actions button {
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  border: none;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-base);
}

.modal-actions button[type="button"] {
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border-medium);
}

.modal-actions button[type="button"]:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-border-dark);
  color: var(--color-text-primary);
}

.modal-actions button[type="submit"],
.modal-actions .primary {
  background: var(--color-navy);
  color: var(--color-white);
  box-shadow: var(--shadow-sm);
}

.modal-actions button[type="submit"]:hover,
.modal-actions .primary:hover {
  background: var(--color-navy-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.modal-actions button[type="submit"]:active,
.modal-actions .primary:active {
  transform: translateY(0);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
  .profile-card {
    padding: var(--space-lg);
  }

  .profile-photo {
    width: 100px;
    height: 100px;
  }

  .profile-info h2 {
    font-size: var(--font-size-lg);
  }

  .modal-content {
    padding: var(--space-xl);
    max-width: calc(100vw - 32px);
  }

  .modal-content h2 {
    font-size: var(--font-size-xl);
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .profile-card {
    padding: var(--space-md);
  }

  .profile-photo {
    width: 80px;
    height: 80px;
  }

  .profile-info p strong {
    display: block;
    margin-bottom: var(--space-xs);
  }

  .modal-content {
    padding: var(--space-lg);
  }

  .btn-join,
  .btn-skip {
    width: 100%;
    margin-right: 0;
    margin-bottom: var(--space-xs);
  }
}

/* ============================================
   MODAL CON PESTAÑAS (TIPO INSTAGRAM)
   ============================================ */

.modal-tabs-container {
  max-width: 700px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

/* Header del modal */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
  flex-shrink: 0;
}

.modal-header h2 {
  margin: 0;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--color-bg-hover);
  color: var(--color-text-secondary);
  font-size: var(--font-size-xl);
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--color-bg-active);
  color: var(--color-text-primary);
  transform: rotate(90deg);
}

/* Pestañas de navegación */
.modal-tabs {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-lg) 0;
  border-bottom: 2px solid var(--color-border-light);
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.modal-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  position: relative;
  white-space: nowrap;
  min-width: 80px;
}

.tab-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.tab-btn.active {
  color: var(--color-accent-light);
  font-weight: var(--font-weight-semibold);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 3px;
  background: var(--color-accent-light);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab-icon {
  font-size: var(--font-size-xl);
  line-height: 1;
}

.tab-label {
  font-size: var(--font-size-xs);
}

/* Body del modal (contenedor de pestañas) */
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xl) 0;
}

/* Contenido de cada pestaña */
.tab-content {
  display: none;
  animation: fadeInContent var(--transition-base);
}

.tab-content.active {
  display: block;
}

@keyframes fadeInContent {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   SECCIÓN DE HORARIO
   ============================================ */

.horario-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* Botón para agregar clase */
.btn-add-class {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border: 2px dashed var(--color-border-medium);
  background: transparent;
  color: var(--color-accent-light);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-add-class:hover {
  border-color: var(--color-accent-light);
  background: rgba(26, 127, 212, 0.08);
}

/* Lista de clases actuales */
.classes-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.class-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

.class-item:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-sm);
}

.class-info {
  flex: 1;
}

.class-info h4 {
  margin: 0 0 var(--space-xs) 0;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.class-details {
  display: flex;
  gap: var(--space-md);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.class-details span {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.class-actions {
  display: flex;
  gap: var(--space-xs);
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: var(--font-size-base);
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.btn-icon.delete:hover {
  background: rgba(220, 53, 69, 0.1);
  color: var(--color-error);
}

/* Formulario de agregar/editar clase */
.add-class-form {
  padding: var(--space-lg);
  background: var(--color-bg-hover);
  border-radius: var(--radius-md);
  margin-top: var(--space-md);
}

.add-class-form.hidden {
  display: none;
}

.add-class-form h3 {
  margin: 0 0 var(--space-lg) 0;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.time-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

/* Botones de acción */
.btn-primary,
.btn-secondary {
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  border: none;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-primary {
  background: var(--color-navy);
  color: var(--color-white);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--color-navy-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.btn-secondary {
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border-medium);
}

.btn-secondary:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-border-dark);
  color: var(--color-text-primary);
}

/* Placeholder para pestañas vacías */
.settings-section {
  text-align: center;
  padding: var(--space-2xl);
}

.settings-section h3 {
  margin: 0 0 var(--space-md) 0;
  font-size: var(--font-size-lg);
  color: var(--color-text-primary);
}

.placeholder-text {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-style: italic;
}

/* ============================================
   RESPONSIVE - MODAL CON PESTAÑAS
   ============================================ */

@media (max-width: 768px) {
  .modal-tabs-container {
    max-width: calc(100vw - 32px);
    max-height: 90vh;
  }

  .tab-btn {
    min-width: 70px;
    padding: var(--space-xs) var(--space-sm);
  }

  .tab-icon {
    font-size: var(--font-size-lg);
  }

  .time-inputs {
    grid-template-columns: 1fr;
  }

  .class-details {
    flex-direction: column;
    gap: var(--space-xs);
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .modal-header h2 {
    font-size: var(--font-size-xl);
  }

  .tab-label {
    display: none;
  }

  .tab-btn {
    min-width: 50px;
  }

  .class-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .class-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ============================================
   FORMULARIO DE EVENTOS
   ============================================ */

#eventForm textarea {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-medium);
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
  font-size: var(--font-size-base);
  font-family: inherit;
  resize: vertical;
  transition: all var(--transition-base);
}

#eventForm textarea:focus {
  outline: none;
  border-color: var(--color-accent-light);
  box-shadow: 0 0 0 3px rgba(26, 127, 212, 0.15);
}

#eventForm textarea:hover {
  border-color: var(--color-border-dark);
}

/* Categoría con colores visuales */
#eventCategory {
  cursor: pointer;
}

#eventCategory option {
  padding: var(--space-sm);
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
}

/* Preview de categoría */
.category-preview {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  margin-right: var(--space-xs);
}

.category-preview.personal {
  background: #7b68ee;
}

.category-preview.examen {
  background: #dc3545;
}

/* ============================================
   FIX PARA FORMULARIO AGREGAR CLASE
   ============================================ */

.add-class-form {
  padding: var(--space-lg);
  background: var(--color-bg-surface) !important;
  border-radius: var(--radius-md);
  margin-top: var(--space-md);
  border: 1px solid var(--color-border-light);
}

.add-class-form label {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary) !important;
}

.add-class-form input,
.add-class-form select {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-medium);
  background: var(--color-bg-card) !important;
  color: var(--color-text-primary) !important;
  font-size: var(--font-size-base);
  transition: all var(--transition-base);
}

.add-class-form input:focus,
.add-class-form select:focus {
  outline: none;
  border-color: var(--color-accent-light);
  box-shadow: 0 0 0 3px rgba(26, 127, 212, 0.15);
}
/* ============================================
   CORRECCIÓN DE ACCESIBILIDAD — CIMA v2
   Elimina exceso de brillo en botones blancos
   ============================================ */

/* Botones blancos/claros — reducir contraste extremo */
.btn-secondary,
button[type="button"]:not(.menu-item):not(.sidebar-bottom-btn):not(.mobile-menu-toggle):not(.header-notification-btn):not(.filter-tag):not(.calendar-nav-btn):not(.toggle-password),
.modal-actions button[type="button"] {
  background: #f1f3f5 !important;
  color: #344054 !important;
  border: 1px solid #d0d5dd !important;
}

.btn-secondary:hover,
.modal-actions button[type="button"]:hover {
  background: #e4e7ec !important;
  border-color: #b2bac8 !important;
  color: #1a2333 !important;
}

/* Botones de acción genéricos con fondo blanco puro — reducir */
button:not([class]):not([type="submit"]) {
  background: #f8f9fa;
  color: var(--color-text-primary);
}

/* Asegurar que todos los botones de acción tengan suficiente contraste de texto */
.btn-primary,
.modal-actions button[type="submit"],
.modal-actions .primary,
.btn-join,
.btn-login {
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}