/* =================================
   ESTILOS MÓVILES - PROFESORHOME
   ================================= */

/* Heredar variables de style.css o definir fallback si no existe */
:root {
  /* Si style.css no carga, estos son fallbacks, pero intentamos usar los mismos nombres */
  --primary-color: #667eea;
  --secondary-color: #764ba2;
  --accent-color: #f093fb;
  --text-dark: #2d3748; /* Alias legacy */
  --text-light: #718096;
  --bg-light: #f7fafc; /* Alias legacy */
  --border-color: #e2e8f0;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
  --border-radius: 12px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Skeleton Loading Animation */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--border-radius);
  color: transparent !important;
  pointer-events: none;
  border: none !important;
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
  border-radius: 4px;
}

.skeleton-card {
  min-height: 150px;
}

.skeleton-btn {
  height: 48px;
  width: 100%;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Micro-animations */
.btn, .mobile-btn, .mobile-btn-secondary, button {
  transition: var(--transition);
}

.btn:active, .mobile-btn:active, .mobile-btn-secondary:active, button:active {
  transform: scale(0.95);
}

/* Reset y configuración base para móviles */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background-color: var(--bg-light);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}



/* Navegación móvil */
.mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--border-color);
  padding: 8px 0;
  z-index: 999;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* Ocultar header móvil cuando no hay usuario logueado */
.not-logged-in .mobile-header {
  display: none !important;
}

.mobile-nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 100%;
  margin: 0 auto;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-light);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: var(--transition);
  min-width: 60px;
}

.mobile-nav-item.active {
  color: var(--primary-color);
  background-color: rgba(102, 126, 234, 0.1);
}

.mobile-nav-item i {
  font-size: 20px;
  margin-bottom: 4px;
}

/* Header móvil */
.mobile-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: white;
  border-bottom: 1px solid var(--border-color);
  padding: 12px 16px;
  z-index: 998;
  box-shadow: var(--shadow);
}

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

.mobile-header h1 {
  margin: 0;
  font-size: 18px;
  color: var(--primary-color);
  font-weight: 600;
}

.mobile-menu-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-dark);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: var(--transition);
}

.mobile-menu-btn:hover {
  background-color: var(--bg-light);
}

/* Contenido principal con espaciado para header y nav */
.mobile-content {
  padding-top: 80px;
  padding-bottom: 80px;
  min-height: 100vh;
}

/* Cards optimizadas para móvil */
.mobile-card {
  background: white;
  border-radius: var(--border-radius);
  padding: 20px;
  margin: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.mobile-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Botones optimizados para táctil */
.mobile-btn {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border: none;
  padding: 16px 24px;
  border-radius: var(--border-radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px; /* Tamaño mínimo táctil recomendado */
  min-width: 48px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.mobile-btn:hover, .mobile-btn:focus {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  outline: none;
}

.mobile-btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow);
}

/* Botones secundarios */
.mobile-btn-secondary {
  background: white;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  padding: 14px 22px;
  border-radius: var(--border-radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  min-width: 48px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.mobile-btn-secondary:hover, .mobile-btn-secondary:focus {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  outline: none;
}

/* Botones de navegación móvil optimizados */
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-light);
  font-size: 12px;
  padding: 12px 16px; /* Aumentado para mejor área táctil */
  border-radius: 12px;
  transition: var(--transition);
  min-width: 60px;
  min-height: 48px; /* Área táctil mínima */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item.active {
  color: var(--primary-color);
  background-color: rgba(102, 126, 234, 0.1);
}

.mobile-nav-item:hover, .mobile-nav-item:focus {
  background-color: rgba(102, 126, 234, 0.05);
  transform: translateY(-1px);
  outline: none;
}

.mobile-nav-item i {
  font-size: 20px;
  margin-bottom: 4px;
}

/* Botón de menú hamburger optimizado */
.mobile-menu-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-dark);
  cursor: pointer;
  padding: 12px; /* Área táctil aumentada */
  border-radius: 12px;
  transition: var(--transition);
  min-height: 48px;
  min-width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.mobile-menu-btn:hover, .mobile-menu-btn:focus {
  background-color: var(--bg-light);
  transform: scale(1.05);
  outline: none;
}

.mobile-menu-btn:active {
  transform: scale(0.95);
}

/* Optimizaciones para formularios táctiles */
.mobile-input {
  width: 100%;
  padding: 16px 20px; /* Padding aumentado para mejor experiencia táctil */
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 16px; /* Previene zoom en iOS */
  background: white;
  transition: var(--transition);
  min-height: 48px;
  touch-action: manipulation;
}

.mobile-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  outline: none;
}

.mobile-textarea {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 16px;
  background: white;
  transition: var(--transition);
  min-height: 120px;
  resize: vertical;
  font-family: inherit;
  touch-action: manipulation;
}

.mobile-textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  outline: none;
}

/* Selectores optimizados para móvil */
.mobile-select {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 16px;
  background: white;
  transition: var(--transition);
  min-height: 48px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
  padding-right: 48px;
}

.mobile-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  outline: none;
}

/* Checkboxes y radios optimizados para táctil */
.mobile-checkbox, .mobile-radio {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  cursor: pointer;
  touch-action: manipulation;
}

.mobile-checkbox-label, .mobile-radio-label {
  display: flex;
  align-items: center;
  padding: 12px 0;
  cursor: pointer;
  min-height: 48px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Botones de acción flotantes */
.mobile-fab {
  position: fixed;
  bottom: 90px; /* Encima de la navegación móvil */
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 997;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.mobile-fab:hover, .mobile-fab:focus {
  transform: scale(1.1);
  box-shadow: 0 12px 30px rgba(102, 126, 234, 0.4);
  outline: none;
}

.mobile-fab:active {
  transform: scale(0.95);
}

/* Formularios móviles */
.mobile-form {
  padding: 20px;
}

.mobile-form-group {
  margin-bottom: 20px;
}

.mobile-form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-dark);
}

.mobile-form-input {
  width: 100%;
  padding: 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 16px;
  transition: var(--transition);
  background: white;
}

.mobile-form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Lista de profesores/clases móvil */
.mobile-list {
  padding: 0 16px;
}

.mobile-list-item {
  background: white;
  border-radius: var(--border-radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.mobile-list-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}


/* Gestos táctiles */
.swipe-item {
  position: relative;
  overflow: hidden;
}

.swipe-actions {
  position: absolute;
  top: 0;
  right: -100px;
  bottom: 0;
  width: 100px;
  background: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: var(--transition);
}

.swipe-item.swiped .swipe-actions {
  right: 0;
}

/* Notificaciones móviles */
.mobile-notification {
  position: fixed;
  top: 70px;
  left: 16px;
  right: 16px;
  background: white;
  border-radius: var(--border-radius);
  padding: 16px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary-color);
  z-index: 1001;
  transform: translateY(-100px);
  transition: var(--transition);
}

.mobile-notification.show {
  transform: translateY(0);
}

/* Loading spinner móvil */
.mobile-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

.mobile-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== OPTIMIZACIONES ADICIONALES PARA FORMULARIOS TÁCTILES ===== */
@media (max-width: 768px) {
    /* Formularios optimizados para táctil */
    .form-control, input, textarea, select {
        min-height: 48px;
        padding: 15px 20px;
        font-size: 16px !important; /* Prevenir zoom en iOS */
        border-radius: 12px;
        border: 2px solid #e1e5e9;
        transition: all 0.3s ease;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-color: #fff;
        touch-action: manipulation;
    }
    
    .form-control:focus, input:focus, textarea:focus, select:focus {
        border-color: #667eea;
        box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
        outline: none;
        transform: scale(1.02);
    }
    
    /* Textarea específico */
    textarea.form-control {
        min-height: 120px;
        resize: vertical;
        line-height: 1.5;
    }
    
    /* Select personalizado */
    select.form-control {
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 15px center;
        background-size: 20px;
        padding-right: 50px;
    }
    
    /* Checkboxes y radios táctiles */
    input[type="checkbox"], input[type="radio"] {
        width: 20px;
        height: 20px;
        margin-right: 12px;
        cursor: pointer;
        transform: scale(1.2);
        accent-color: #667eea;
    }
    
    /* Labels táctiles */
    label {
        font-size: 16px;
        font-weight: 500;
        color: #374151;
        margin-bottom: 8px;
        display: block;
        cursor: pointer;
        line-height: 1.4;
    }
    
    /* Grupos de formulario con mejor espaciado */
    .form-group {
        margin-bottom: 25px;
        position: relative;
    }
    
    .form-group:last-child {
        margin-bottom: 0;
    }
    
    /* Mensajes de error táctiles */
    .form-error, .invalid-feedback {
        color: #dc3545;
        font-size: 14px;
        margin-top: 8px;
        display: block;
        font-weight: 500;
    }
    
    /* Botones de formulario optimizados */
    .form-group .btn {
        width: 100%;
        margin-top: 10px;
        font-weight: 600;
        letter-spacing: 0.5px;
    }
    
    /* Inputs con iconos */
    .input-group {
        position: relative;
        display: flex;
        align-items: center;
    }
    
    .input-group-prepend, .input-group-append {
        position: absolute;
        z-index: 10;
        padding: 0 15px;
        color: #6b7280;
        pointer-events: none;
    }
    
    .input-group-prepend {
        left: 0;
    }
    
    .input-group-append {
        right: 0;
    }
    
    .input-group .form-control {
        padding-left: 50px;
    }
    
    .input-group.has-append .form-control {
        padding-right: 50px;
    }
    
    /* Switches táctiles */
    .form-switch {
        display: flex;
        align-items: center;
        margin-bottom: 15px;
    }
    
    .form-switch input[type="checkbox"] {
        width: 50px;
        height: 28px;
        border-radius: 14px;
        background: #e5e7eb;
        border: none;
        cursor: pointer;
        position: relative;
        transition: all 0.3s ease;
        -webkit-appearance: none;
        appearance: none;
        margin-right: 12px;
    }
    
    .form-switch input[type="checkbox"]:checked {
        background: #667eea;
    }
    
    .form-switch input[type="checkbox"]::before {
        content: '';
        position: absolute;
        width: 24px;
        height: 24px;
        border-radius: 50%;
        background: white;
        top: 2px;
        left: 2px;
        transition: all 0.3s ease;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    
    .form-switch input[type="checkbox"]:checked::before {
        transform: translateX(22px);
    }
    
    /* Rangos táctiles */
    input[type="range"] {
        width: 100%;
        height: 8px;
        border-radius: 4px;
        background: #e5e7eb;
        outline: none;
        -webkit-appearance: none;
        appearance: none;
        margin: 15px 0;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 24px;
        height: 24px;
        border-radius: 50%;
        background: #667eea;
        cursor: pointer;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
        transition: all 0.2s ease;
    }
    
    input[type="range"]::-webkit-slider-thumb:hover {
        transform: scale(1.1);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    }
    
    input[type="range"]::-moz-range-thumb {
        width: 24px;
        height: 24px;
        border-radius: 50%;
        background: #667eea;
        cursor: pointer;
        border: none;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    }
    
    /* Botones flotantes de acción */
    .fab {
        position: fixed;
        bottom: 80px;
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        border: none;
        font-size: 24px;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
        transition: all 0.3s ease;
        z-index: 1000;
        display: flex;
        align-items: center;
        justify-content: center;
        -webkit-tap-highlight-color: transparent;
    }
    
    .fab:hover {
        transform: scale(1.1);
        box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
    }
    
    .fab:active {
        transform: scale(0.95);
    }
    
    /* Mejoras en el espaciado general */
    .container-fluid {
        padding: 15px;
    }
    
    .row {
        margin: 0 -10px;
    }
    
    .col, [class*="col-"] {
        padding: 0 10px;
        margin-bottom: 20px;
    }
    
    /* Cards con mejor espaciado */
    .card {
        border-radius: 16px;
        border: none;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
        margin-bottom: 20px;
        overflow: hidden;
        transition: all 0.3s ease;
    }
    
    .card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    }
    
    .card-header {
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
        border-bottom: 1px solid #dee2e6;
        padding: 20px;
        font-weight: 600;
        font-size: 18px;
    }
    
    .card-body {
        padding: 25px;
    }
    
    .card-footer {
        background: #f8f9fa;
        border-top: 1px solid #dee2e6;
        padding: 20px;
    }
    
    /* Listas optimizadas */
    .list-group-item {
        padding: 20px;
        border: none;
        border-bottom: 1px solid #f0f0f0;
        transition: all 0.2s ease;
        cursor: pointer;
        min-height: 60px;
        display: flex;
        align-items: center;
    }
    
    .list-group-item:hover {
        background: #f8f9fa;
        transform: translateX(5px);
    }
    
    .list-group-item:last-child {
        border-bottom: none;
    }
    
    /* Badges táctiles */
    .badge {
        padding: 8px 12px;
        font-size: 12px;
        font-weight: 600;
        border-radius: 20px;
        letter-spacing: 0.5px;
        text-transform: uppercase;
    }
    
    /* Alertas móviles */
    .alert {
        border-radius: 12px;
        padding: 20px;
        margin-bottom: 20px;
        border: none;
        font-weight: 500;
        position: relative;
    }
    
    .alert-dismissible .btn-close {
        position: absolute;
        top: 15px;
        right: 15px;
        padding: 8px;
        background: none;
        border: none;
        font-size: 20px;
        cursor: pointer;
        opacity: 0.7;
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: all 0.2s ease;
    }
    
    .alert-dismissible .btn-close:hover {
        opacity: 1;
        background: rgba(0, 0, 0, 0.1);
    }
    
    /* Navegación de pestañas móvil */
    .nav-tabs {
        border-bottom: 2px solid #e9ecef;
        margin-bottom: 25px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
    
    .nav-tabs .nav-link {
        padding: 15px 20px;
        border: none;
        border-bottom: 3px solid transparent;
        color: #6b7280;
        font-weight: 500;
        transition: all 0.3s ease;
        min-width: 120px;
        text-align: center;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    
    .nav-tabs .nav-link.active {
        color: #667eea;
        border-bottom-color: #667eea;
        background: none;
    }
    
    .nav-tabs .nav-link:hover {
        color: #667eea;
        background: rgba(102, 126, 234, 0.05);
    }
    
    /* Mejoras en tooltips para móvil */
    .tooltip {
        font-size: 14px;
        padding: 8px 12px;
        border-radius: 8px;
        max-width: 250px;
    }
    
    /* Dropdowns móviles */
    .dropdown-menu {
        border-radius: 12px;
        border: none;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        padding: 10px 0;
        margin-top: 5px;
    }
    
    .dropdown-item {
        padding: 15px 20px;
        font-size: 16px;
        transition: all 0.2s ease;
        cursor: pointer;
        min-height: 48px;
        display: flex;
        align-items: center;
    }
    
    .dropdown-item:hover {
        background: #f8f9fa;
        color: #667eea;
        transform: translateX(5px);
    }
    
    .dropdown-item i {
        margin-right: 12px;
        width: 20px;
        text-align: center;
    }
}

/* ===== OPTIMIZACIONES ESPECÍFICAS PARA PANTALLAS MUY PEQUEÑAS ===== */
@media (max-width: 480px) {
    .form-control, input, textarea, select {
        padding: 12px 16px;
        font-size: 16px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .card-header {
        padding: 15px;
        font-size: 16px;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 15px;
    }
    
    .fab {
        width: 48px;
        height: 48px;
        font-size: 20px;
        bottom: 70px;
        right: 15px;
    }
    
    .container, .container-fluid {
        padding: 10px;
    }
    
    .nav-tabs .nav-link {
        padding: 12px 16px;
        min-width: 100px;
        font-size: 14px;
    }
}

/* ... existing code ... */