/* ===== MEJORAS PARA MÓVILES - PLATAFORMA CONEXIUM ===== */

/* Touch targets mínimos para accesibilidad móvil */
.touch-target {
    min-height: 44px;
    min-width: 44px;
}

/* Botones optimizados para móviles */
.btn-mobile {
    padding: 12px 24px;
    font-size: 16px;
    min-height: 48px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

/* Tablas responsivas con scroll horizontal */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
    border-radius: 8px;
}

.table-container::-webkit-scrollbar {
    height: 6px;
}

.table-container::-webkit-scrollbar-track {
    background: transparent;
}

.table-container::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.5);
    border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background-color: rgba(156, 163, 175, 0.8);
}

/* Estados de carga para overlays */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    backdrop-filter: blur(2px);
}

.dark .loading-overlay {
    background: rgba(15, 23, 42, 0.9);
}

/* Mejoras específicas para pantallas pequeñas */
@media (max-width: 640px) {
    /* Headers responsivos */
    h1 {
        font-size: 1.875rem !important; /* 30px */
        line-height: 2.25rem !important;
    }

    h2 {
        font-size: 1.5rem !important; /* 24px */
        line-height: 2rem !important;
    }

    /* Espaciado mejorado */
    .container-mobile {
        padding: 16px;
    }

    /* Formularios optimizados */
    .form-section {
        margin-bottom: 1.5rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="url"],
    input[type="date"],
    input[type="time"],
    input[type="datetime-local"],
    input[type="number"],
    input[type="search"],
    input[type="file"],
    textarea,
    select {
        min-height: 48px;
        font-size: 16px; /* Evita zoom automático en iOS */
        padding: 12px 16px;
        border-radius: 8px;
    }

    /* Checkbox y radio buttons más grandes */
    input[type="checkbox"],
    input[type="radio"] {
        min-height: 20px;
        min-width: 20px;
        margin-right: 12px;
    }

    /* Labels más espaciadas */
    label {
        margin-bottom: 8px;
        font-size: 14px;
        font-weight: 500;
    }

    /* Acciones de formulario en columna */
    .form-actions {
        flex-direction: column-reverse !important;
        gap: 12px !important;
    }

    .form-actions a,
    .form-actions button {
        width: 100% !important;
        text-align: center !important;
        justify-content: center !important;
        min-height: 48px !important;
    }

    /* Botones en móviles */
    .btn-mobile {
        width: 100%;
        margin-bottom: 8px;
    }

    /* Tablas en móviles */
    table {
        font-size: 14px;
        min-width: 600px; /* Fuerza scroll horizontal */
    }

    th, td {
        padding: 8px 12px !important;
        white-space: nowrap;
    }

    /* Cards más compactas */
    .card-mobile {
        padding: 16px;
        margin-bottom: 16px;
    }

    /* Portfolio entries en móviles */
    .portfolio-entry {
        padding: 16px !important;
        margin-bottom: 12px;
    }

    /* Mostrar controles de hover siempre en móviles */
    .portfolio-entry .group-hover\:opacity-100,
    .card .group-hover\:opacity-100 {
        opacity: 1 !important;
    }

    /* Skills container scrolleable */
    .skills-container {
        max-height: 200px;
        overflow-y: auto;
    }

    /* Checkbox labels más grandes */
    .checkbox-label {
        padding: 12px;
        border-radius: 6px;
        background: rgba(0, 0, 0, 0.02);
        margin-bottom: 6px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .dark .checkbox-label {
        background: rgba(255, 255, 255, 0.05);
    }

    /* Navegación móvil */
    .nav-mobile {
        padding: 12px 16px;
    }

    /* Modales en móviles */
    .modal-content {
        margin: 16px;
        max-height: calc(100vh - 32px);
        overflow-y: auto;
    }

    /* Toast notifications en móviles */
    #toast-notification {
        left: 16px;
        right: 16px;
        top: 16px;
        max-width: none;
    }

    /* Ocultar elementos no esenciales en móviles */
    .hidden-mobile {
        display: none !important;
    }

    /* Texto más legible */
    .text-mobile {
        font-size: 16px;
        line-height: 1.5;
    }

    /* Espaciado entre secciones */
    .section-mobile {
        margin-bottom: 2rem;
    }
}

/* Mejoras específicas para tablets */
@media (min-width: 641px) and (max-width: 1024px) {
    .table-container {
        overflow-x: visible;
    }

    .btn-mobile {
        width: auto;
        min-width: 120px;
    }

    .form-actions {
        flex-direction: row !important;
    }

    .form-actions a,
    .form-actions button {
        width: auto !important;
    }
}

/* Estados de carga para formularios */
.form-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.form-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
}

.dark .form-loading::after {
    background: rgba(15, 23, 42, 0.8);
}

/* Animaciones suaves para cambios de estado */
.smooth-transition {
    transition: all 0.2s ease-in-out;
}

/* Helpers para ocultar/mostrar en diferentes pantallas */
.show-mobile {
    display: none;
}

.hide-mobile {
    display: block;
}

@media (max-width: 640px) {
    .show-mobile {
        display: block;
    }

    .hide-mobile {
        display: none;
    }
}

/* Focus mejorado para navegación por teclado */
.focus-improved:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Indicadores de carga inline */
.loading-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Mejoras de contraste para mejor legibilidad */
.high-contrast {
    filter: contrast(1.2);
}

/* Estados hover mejorados para móviles */
@media (hover: hover) {
    .hover-scale:hover {
        transform: scale(1.02);
    }

    .hover-shadow:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
}

/* Para dispositivos que no soportan hover (móviles) */
@media (hover: none) {
    .hover-scale:active {
        transform: scale(0.98);
    }

    .hover-shadow:active {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
}