/* ============================================
   UTILIDADES REUTILIZABLES - style_utilities.css
   Clases helper para evitar inline styles
   Usa variables del sistema unificado (style.css)
   ============================================ */

/* Avatares circulares */
.avatar-circle {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar-xs { width: 30px; height: 30px; font-size: 14px; }
.avatar-sm { width: 36px; height: 36px; font-size: 16px; }
.avatar-md { width: 44px; height: 44px; font-size: 20px; }
.avatar-lg { width: 60px; height: 60px; font-size: 24px; }

/* Contenedores de ancho fijo */
.container-xs { max-width: 480px; margin-left: auto; margin-right: auto; }
.container-custom-sm { max-width: 720px; margin-left: auto; margin-right: auto; }

/* Live Grading - Estilos consolidados */
.live-grading-root {
  min-height: calc(100vh - 60px);
  overflow-x: hidden;
}
.live-grading-fullheight {
  height: calc(100vh - 60px - 2rem);
  padding: var(--spacing-lg);
}
.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--spacing-sm);
}
.hover-shadow-card {
  transition: all var(--transition-base);
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-md);
}
.hover-shadow-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg) !important;
  border-color: var(--primary-color);
}

/* Live Grading Multi - Cards de estudiantes responsive (v2.3.22) */
.live-grading-multi-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.live-grading-multi-card .card-body {
  flex: 1;
  overflow-y: auto;
}

/* Optimización de altura para elementos en cards compactas */
.live-grading-element-card {
  min-height: auto;
}
.live-grading-element-card .card-body {
  padding: 0.5rem;
}

/* Responsive: ajustes por breakpoint */
@media (max-width: 767px) {
  /* Móvil: mantener espaciado generoso para táctil */
  .live-grading-multi-card .card-body {
    padding: 0.75rem;
  }
  .live-grading-element-card .card-body {
    padding: 0.5rem;
  }
}

@media (min-width: 768px) and (max-width: 991px) {
  /* Tablet: 2 columnas, cards moderadamente compactas */
  .live-grading-multi-card {
    min-height: 400px;
  }
}

@media (min-width: 992px) {
  /* Desktop: 3-4 columnas, cards compactas */
  .live-grading-multi-card {
    min-height: 350px;
    max-height: 600px;
  }
  .live-grading-multi-card .card-header {
    padding: 0.4rem 0.75rem;
  }
  .live-grading-element-card .card-header {
    padding: 0.3rem 0.5rem;
  }
}

@media (min-width: 1400px) {
  /* Desktop XL: 4 columnas, aprovechar espacio */
  .live-grading-multi-card {
    min-height: 320px;
    max-height: 550px;
  }
}

/* Helpers de texto */
.ws-prewrap { white-space: pre-wrap; }
.min-h-60 { min-height: 60px; }

/* Tamaños de fuente */
.text-xs { font-size: 0.7rem; }
.text-sm-light { font-size: 0.8rem; line-height: 1.3; }

/* Icono decorativo placeholder (vacío/en espera) */
.icon-placeholder-sm { font-size: 2rem; opacity: 0.3; margin-bottom: 0.5rem; }
.icon-placeholder-xl { font-size: 3.5rem; opacity: 0.4; margin-bottom: 1rem; }

/* Flex: min-width 0 para permitir text-truncate en hijos flex */
.min-w-0 { min-width: 0; }

/* Colores de marca */
.text-brand { color: var(--primary-color); }
.text-brand-bold { color: var(--primary-color); font-weight: 700; }

/* Border radius extendido */
.card-rounded-xl { border-radius: 16px; }

/* Utilidades de login */
.login-container { min-height: calc(100vh - 3.75rem); }
.mw-450 { max-width: 450px; }

/* Border-radius adicional para formularios */
.rounded-10 { border-radius: 10px !important; }

/* Animación de entrada para cards y paneles (usa @keyframes fadeIn de style.css) */
.anim-fade-in { animation: fadeIn 0.45s ease-out both; }

/* Tamaño de fuente intermedio para botones prominentes */
.fs-105 { font-size: 1.05rem; }

/* Max-width para selects en tablas de admin */
.mw-select-sm { max-width: 200px; }
.mw-select-md { max-width: 280px; }

/* Max-width para nombres truncados (ej. live grading) */
.mw-student-name { max-width: 150px; }

/* Anchos de columnas para tablas de historial */
.th-w-130 { width: 130px; }
.th-w-100 { width: 100px; }
.th-w-110 { width: 110px; }
.th-w-120 { width: 120px; }
.th-w-200 { width: 200px; }

/* Anchos de columnas para tablas de calificación rápida */
.th-w-40  { width: 40px; }
.th-w-250 { width: 250px; }

/* Anchos mínimos para columnas de tabla (second_chance, resumen) */
.th-min-120 { min-width: 120px; }
.th-min-140 { min-width: 140px; }
.th-min-200 { min-width: 200px; }
.th-min-260 { min-width: 260px; }
.th-min-300 { min-width: 300px; }

/* Anchos mínimos para botones y dropdowns (subject) */
.min-w-110 { min-width: 110px; }
.min-w-130 { min-width: 130px; }
.min-w-240 { min-width: 240px; }
.min-w-280 { min-width: 280px; }
.min-w-300 { min-width: 300px; }

/* Altura fija para botones con alineación vertical */
.h-31 { height: 31px; line-height: 1; }

/* Ancho fijo pequeño para inputs numéricos de elementos */
.w-60 { width: 60px; }

/* Ancho máximo con centrado para inputs simples en tabla */
.mw-100-auto { max-width: 100px; margin: 0 auto; }

/* Texto truncado con ancho máximo para etiquetas de elementos */
.mw-120-truncate { max-width: 120px; }

/* Botones de acción mínimos en encabezados de tabla */
.btn-micro { width: 20px; height: 20px; font-size: 10px; line-height: 1; }
.btn-micro-md { width: 24px; height: 24px; font-size: 11px; line-height: 1; }

/* Botones de accion icon-only reutilizables */
.wc-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0 !important;
  line-height: 1;
  vertical-align: middle;
  box-sizing: border-box;
}

.wc-action-btn:focus-visible {
  box-shadow: 0 0 0 0.2rem rgba(27, 57, 106, 0.25);
}

.wc-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.wc-action-icon-sm { font-size: 0.85rem; }
.wc-action-icon-md { font-size: 0.95rem; }
.wc-action-icon-lg { font-size: 1.1rem; }

@media (max-width: 768px) {
  .wc-action-btn {
    width: 2.25rem;
    height: 2.25rem;
  }

  .wc-action-icon-md {
    font-size: 1rem;
  }
}

/* Textarea con resize vertical (campos de observaciones) */
.textarea-notes { resize: vertical; min-height: 38px; }

/* Flex helpers */
.flex-1 { flex: 1 1 0%; }

/* Width helpers para formularios inline en JS */
.w-50 { width: 50px; }
.w-80 { width: 80px; }

/* Ancho máximo para títulos cortos (ej. elementos compuestos) */
.mw-80 { max-width: 80px; }

/* Input inline de equipo por unidad */
.team-input { width: 70px; text-align: center; }

/* Badge compacto para tipo de estudiante */
.badge-xs { font-size: 0.65rem; padding: 0.1rem 0.3rem; }

/* Modal de draft de elementos (openElementsDraftModal) */
.modal-draft-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-draft-dialog {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 20px;
  max-width: 620px;
  width: 90%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.modal-draft-body {
  flex: 1 1 0%;
  overflow-y: auto;
  min-height: 0;
}
.modal-draft-list {
  max-height: 300px;
  overflow-y: auto;
}

/* Badge de cambios pendientes en draft state */
.badge-dirty {
  background-color: var(--warning-color);
  color: #fff;
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-full);
  font-weight: 600;
}

/* Panel Analítico de Materia: área de contenido del concentrado activo */
.panel-tab-content {
  border: 1px solid #dee2e6;
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: #fff;
  overflow: hidden;
}

/* Vista Subject: área de contenido bajo las tabs de columnas.
   Igual que panel-tab-content pero sin overflow:hidden para que los
   dropdowns (Columnas, menús) no queden recortados. */
.subject-tab-content {
  border: 1px solid #dee2e6;
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: #fff;
}

/* Texto pequeño y cursor de acción */
.text-sm { font-size: 0.8rem; }
.cursor-pointer { cursor: pointer; }
.min-w-180 { min-width: 180px; }
.min-w-260 { min-width: 260px; }
.max-w-400 { max-width: 400px; }

/* Padding helpers específicos */
.pt-075 { padding-top: 0.75rem; }
.pb-075 { padding-bottom: 0.75rem; }

/* Display helpers dinámicos (para control JS) */
.d-none-js { display: none; }

/* ============================================
   UTILIDADES RESPONSIVE ADICIONALES
   ============================================ */

/* Ocultar elementos en mobile */
@media (max-width: 576px) {
  .d-none-mobile {
    display: none !important;
  }
}

/* Mostrar solo en mobile */
.d-block-mobile {
  display: none !important;
}

@media (max-width: 576px) {
  .d-block-mobile {
    display: block !important;
  }
}

/* Flex direction responsive */
@media (max-width: 768px) {
  .flex-md-column {
    flex-direction: column !important;
  }
}

/* Text alignment responsive */
@media (max-width: 576px) {
  .text-sm-center {
    text-align: center !important;
  }
  
  .text-sm-start {
    text-align: left !important;
  }
}

/* Width utilities responsive */
@media (max-width: 576px) {
  .w-sm-100 {
    width: 100% !important;
  }
  
  .max-w-sm-none {
    max-width: none !important;
  }
}

/* Spacing utilities para mobile */
@media (max-width: 576px) {
  .mb-sm-2 { margin-bottom: 0.5rem !important; }
  .mb-sm-3 { margin-bottom: 1rem !important; }
  .mt-sm-2 { margin-top: 0.5rem !important; }
  .mt-sm-3 { margin-top: 1rem !important; }
  .p-sm-2 { padding: 0.5rem !important; }
  .px-sm-2 { padding-left: 0.5rem !important; padding-right: 0.5rem !important; }
  .py-sm-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
}

/* Prevenir que botones con texto largo rompan layout */
.btn {
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn.text-wrap {
  white-space: normal;
  word-break: break-word;
}

/* Grid responsive mejorado para cards */
.card-grid-responsive {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

@media (max-width: 576px) {
  .card-grid-responsive {
    grid-template-columns: 1fr;
  }
}

/* Tablas responsive con mejor manejo */
.table-responsive-custom {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
}

@media (max-width: 768px) {
  .table-responsive-custom table {
    min-width: 600px;
  }
}

/* Mejor manejo de imágenes responsive */
.img-responsive {
  max-width: 100%;
  height: auto;
  display: block;
}

