/* ============================================
   ESTILOS MÓVILES - WEBCLASS
   Aplicados solo en pantallas ≤768px
   ============================================ */

/* ============================================
   HEADER Y NAVEGACIÓN (Mobile)
   ============================================ */

@media (max-width: 768px) {
  .container-fluid {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  
  h1.h4 {
    font-size: 1.1rem !important;
  }
  
  /* Dropdown de unidades más compacto */
  h1 .dropdown .btn {
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
  }
  
  /* Info de pesos más pequeña */
  .text-muted.small {
    font-size: 0.7rem !important;
    line-height: 1.3;
  }
  
  /* Botones de acción más grandes para touch */
  .btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    min-height: 44px;
  }
  
  /* Grupos de botones */
  .d-flex.gap-2.flex-wrap {
    gap: 0.5rem !important;
  }
  
  .dropdown-menu {
    font-size: 0.9rem;
    max-width: calc(100vw - 2rem);
  }
  
  /* Botón de volver destacado */
  a.btn-outline-secondary[href*="dashboard"] {
    background-color: rgba(108, 117, 125, 0.1);
  }
  
  /* Card headers */
  .card-header {
    padding: var(--spacing-sm);
  }
  
  .card-header strong {
    font-size: 0.95rem;
  }
  
  /* Toggle Normal/Redondeado */
  .btn-group-sm .btn {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.8rem;
  }
  
  /* Barra de filtros */
  .p-3.border-bottom.bg-light {
    padding: var(--spacing-sm) !important;
  }
  
  /* Buscador más grande */
  #js-filter-name,
  #js-summary-filter-name,
  #js-sc-filter-name {
    font-size: 16px !important;
    min-height: 44px;
  }
  
  /* Botones de filtro */
  .btn-group[role="group"] {
    flex-wrap: wrap;
  }
  
  /* Controles solo escritorio: tabulación, presets, columnas */
  .desktop-controls {
    display: none !important;
  }
  
  /* Contador de estudiantes */
  #js-student-counter,
  #js-summary-counter,
  #js-sc-counter {
    font-size: 0.75rem;
  }
}

@media (max-width: 768px) {
  /* ============================================
     MODALES Y OVERLAYS
     ============================================ */
  
  .modal-content {
    border-radius: 12px 12px 0 0;
  }
  
  .modal-header {
    padding: 1.25rem;
  }
  
  .modal-body {
    padding: 1.25rem;
    max-height: 70vh;
    overflow-y: auto;
  }
  
  .modal-footer {
    padding: 1rem 1.25rem;
  }
  
  .modal-footer .btn {
    min-height: 48px;
    flex: 1;
  }
  
  /* ============================================
     AJUSTES GENERALES
     ============================================ */
  
  /* Navbar móvil */
  .navbar {
    padding: 0.75rem 1rem;
  }
  
  .navbar-brand {
    font-size: 1rem;
  }
  
  /* Cards generales */
  .card {
    border-radius: 12px;
    margin-bottom: 1rem;
  }
  
  .card-header {
    padding: 1rem;
    border-radius: 12px 12px 0 0 !important;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  /* Botones generales */
  .btn {
    min-height: 44px; /* Guía de accesibilidad */
    font-size: 0.95rem;
  }
  
  .btn-sm {
    min-height: 38px;
    font-size: 0.85rem;
  }
  
  .btn-lg {
    min-height: 54px;
    font-size: 1.1rem;
  }
  
  /* Forms */
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="password"],
  select,
  textarea {
    font-size: 16px !important; /* Evita zoom en iOS */
    min-height: 44px;
  }
  
  /* Tables si es necesario mostrarlas */
  .table {
    font-size: 0.85rem;
  }
  
  .table th,
  .table td {
    padding: 0.5rem 0.25rem;
  }
  
  /* Espaciado de contenido principal */
  .main-content {
    padding: 0.75rem;
  }
  
  /* Headers de página */
  h1, .h1 { font-size: 1.5rem; }
  h2, .h2 { font-size: 1.3rem; }
  h3, .h3 { font-size: 1.15rem; }
  h4, .h4 { font-size: 1.05rem; }
  h5, .h5 { font-size: 0.95rem; }
  
  /* Reducir gaps en flex */
  .gap-3 { gap: 0.75rem !important; }
  .gap-2 { gap: 0.5rem !important; }
  
}



/* ============================================
   ANIMACIONES Y TRANSICIONES
   ============================================ */

@media (max-width: 768px) {

  .accordion-button {
    transition: background-color 0.2s, color 0.2s;
  }
  
  .btn {
    transition: all 0.2s ease;
  }
  
  .btn:active {
    transform: scale(0.95);
  }
  
}

/* ============================================
   TABLA DE SUBJECT - Optimización Móvil
   Ajustes para columnas sticky y legibilidad
   ============================================ */
@media (max-width: 768px) {
  /* ---- COLUMNA NOMBRE: quitar sticky, bordes y fondo especial ---- */
  .subject-table-container > table.table-sm.table-bordered > thead > tr > th:first-child,
  .subject-table-container > table.table-sm.table-bordered > tbody > tr > td:first-child {
    position: relative !important;
    left: auto !important;
    z-index: auto !important;
    box-shadow: none !important;
    border-right: 1px solid #dee2e6 !important;
    background-color: inherit !important;
    background-image: none !important;
    min-width: 140px !important;
    max-width: 180px !important;
  }

  /* Truncar nombres largos con ellipsis */
  .subject-table-container td:first-child .js-student-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
    display: inline-block;
    vertical-align: middle;
  }

  /* Botón enfocar fila (📍): compacto en móvil */
  .subject-table-container .btn-focus-row {
    font-size: 0.7rem !important;
    padding: 0 !important;
    width: 20px !important;
    height: 20px !important;
    line-height: 20px !important;
  }

  /* ---- COLUMNA EQUIPO: quitar sticky, bordes normales ---- */
  .subject-table-container > table.table-sm.table-bordered > thead > tr > th.col-sticky-team,
  .subject-table-container > table.table-sm.table-bordered > tbody > tr > td.col-sticky-team {
    position: relative !important;
    left: auto !important;
    box-shadow: none !important;
    border-right: 1px solid #dee2e6 !important;
    background-color: inherit !important;
    min-width: 55px !important;
  }

  /* Input equipo más compacto */
  td.col-sticky-team .js-team-inline {
    width: 45px !important;
    padding: 0.15rem 0.25rem !important;
    font-size: 0.78rem !important;
    min-height: auto !important;
  }

  /* ---- COLUMNAS DE TEXTO LARGO: reducir al mínimo ---- */
  th[data-col-group="annotation"],
  td[data-col-group="annotation"],
  th[data-col-group="ex-notes"],
  td[data-col-group="ex-notes"],
  th[data-col-group="exam-notes"],
  td[data-col-group="exam-notes"] {
    min-width: 80px !important;
    max-width: 120px !important;
  }

  /* Textareas más compactos */
  .subject-table-container textarea {
    min-height: 30px !important;
    font-size: 0.75rem !important;
  }

  /* Micro-botones de acción: respetar tamaño compacto en tabla */
  .subject-table-container .btn-group-sm .btn {
    min-height: auto !important;
    padding: 0 !important;
  }

  /* ---- BARRA DE FILTROS ---- */
  /* Filtro de equipo: ancho suficiente para "👥 Todos" */
  #js-filter-team {
    min-width: 110px !important;
    font-size: 0.78rem !important;
    padding: 0.25rem 0.4rem !important;
    min-height: 34px !important;
  }

  /* Botones de estado: más compactos */
  .js-status-filter {
    font-size: 0.72rem !important;
    padding: 0.25rem 0.5rem !important;
    min-height: 34px !important;
  }

  /* Input de búsqueda: no tan alto */
  #js-filter-name {
    min-height: 36px !important;
  }

  /* Card header botones: permitir wrap y compactar */
  .card-header .btn {
    font-size: 0.75rem !important;
    padding: 0.3rem 0.5rem !important;
    min-height: 32px !important;
  }

  /* Contenedor de tabla: max-height mayor en móvil */
  .subject-table-container {
    max-height: 65vh !important;
  }
}
