/* GROW Platform - Optimización Móvil 2025 */
/* Activación automática en dispositivos móviles */

/* Variables específicas para móvil */
:root {
    /* Tamaños táctiles */
    --touch-target-min: 44px;
    --touch-target-comfortable: 48px;
    --touch-target-large: 56px;
    
    /* Espaciado móvil */
    --mobile-padding: 16px;
    --mobile-margin: 12px;
    --mobile-gap: 8px;
    
    /* Tipografía móvil */
    --mobile-text-xs: 12px;
    --mobile-text-sm: 14px;
    --mobile-text-base: 16px;
    --mobile-text-lg: 18px;
    --mobile-text-xl: 20px;
    --mobile-text-2xl: 24px;
    
    /* Velocidades de animación móvil */
    --mobile-transition-fast: 0.2s ease;
    --mobile-transition-normal: 0.3s ease;
    --mobile-transition-slow: 0.4s ease;
}

/* Reset móvil */
@media (max-width: 768px) {
    * {
        -webkit-tap-highlight-color: rgba(255, 0, 0, 0.2);
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    input, textarea, select {
        -webkit-user-select: text;
        user-select: text;
    }
    
    /* Prevenir zoom en inputs */
    input, select, textarea {
        font-size: 16px !important;
    }
    
    /* Scroll suave en móvil */
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
    
    body {
        overflow-x: hidden;
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
}

/* Header móvil mejorado */
@media (max-width: 768px) {
    .corporate-header {
        position: sticky;
        top: 0;
        z-index: 1000;
        padding: 12px 16px;
        backdrop-filter: blur(20px);
        border-bottom: 1px solid rgba(255, 0, 0, 0.2);
    }
    
    .corporate-header .container {
        flex-direction: column;
        gap: 12px;
    }
    
    /* Logo móvil */
    .corporate-logo {
        font-size: 24px;
        text-align: center;
    }
    
    /* Navegación móvil */
    .corporate-nav {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .corporate-nav::-webkit-scrollbar {
        display: none;
    }
    
    .corporate-nav ul {
        display: flex;
        gap: 8px;
        padding: 8px 0;
        min-width: max-content;
    }
    
    .corporate-nav li {
        flex-shrink: 0;
    }
    
    .corporate-nav a {
        display: block;
        padding: 8px 16px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 20px;
        font-size: 14px;
        white-space: nowrap;
        min-height: var(--touch-target-min);
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Menú hamburguesa */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    padding: 8px;
    cursor: pointer;
    min-height: var(--touch-target-min);
    min-width: var(--touch-target-min);
    border-radius: 8px;
    transition: background-color var(--mobile-transition-fast);
}

.mobile-menu-toggle:hover {
    background: rgba(255, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .corporate-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(20px);
        border-top: 1px solid rgba(255, 0, 0, 0.2);
        padding: 16px;
        z-index: 999;
    }
    
    .corporate-nav.active {
        display: block;
        animation: slideDown 0.3s ease;
    }
    
    .corporate-nav ul {
        flex-direction: column;
        gap: 12px;
    }
    
    .corporate-nav a {
        padding: 16px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 0, 0, 0.2);
        text-align: center;
        font-size: 16px;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cards móviles optimizadas */
@media (max-width: 768px) {
    .glass-card, .card-2025, .corporate-card {
        margin: 8px 0;
        padding: 16px;
        border-radius: 16px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
    
    .glass-card:hover, .card-2025:hover {
        transform: none; /* Desactivar hover en móvil */
    }
    
    /* Grid móvil */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .songs-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Botones móviles optimizados */
@media (max-width: 768px) {
    .btn-futuristic, .btn-2025, .btn-corporate {
        min-height: var(--touch-target-comfortable);
        padding: 12px 20px;
        font-size: 16px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        margin-bottom: 8px;
    }
    
    .btn-futuristic:active, .btn-2025:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* Formularios móviles */
@media (max-width: 768px) {
    .form-input, input, textarea, select {
        min-height: var(--touch-target-comfortable);
        padding: 16px;
        font-size: 16px;
        border-radius: 12px;
        width: 100%;
        margin-bottom: 16px;
    }
    
    .form-label {
        font-size: 16px;
        margin-bottom: 8px;
        font-weight: 600;
    }
    
    /* Mejorar selects en móvil */
    select {
        appearance: none;
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
        background-position: right 12px center;
        background-repeat: no-repeat;
        background-size: 16px;
        padding-right: 40px;
    }
}

/* Tablas móviles responsivas */
@media (max-width: 768px) {
    .table-2025 {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-2025 th,
    .table-2025 td {
        padding: 12px 8px;
        font-size: 14px;
    }
    
    /* Tabla como cards en móvil */
    .mobile-table-cards {
        display: none;
    }
    
    .mobile-table-cards .table-card {
        background: rgba(255, 255, 255, 0.05);
        border-radius: 12px;
        padding: 16px;
        margin-bottom: 12px;
        border: 1px solid rgba(255, 0, 0, 0.2);
    }
    
    .mobile-table-cards .table-card-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .mobile-table-cards .table-card-row:last-child {
        border-bottom: none;
    }
    
    .mobile-table-cards .table-card-label {
        font-weight: 600;
        color: #FF0000;
        font-size: 14px;
    }
    
    .mobile-table-cards .table-card-value {
        color: white;
        font-size: 14px;
        text-align: right;
    }
}

/* Modales móviles */
@media (max-width: 768px) {
    .modal-2025 {
        padding: 16px;
        align-items: flex-end;
    }
    
    .modal-content {
        width: 100%;
        max-width: none;
        margin: 0;
        border-radius: 20px 20px 0 0;
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-2025.active .modal-content {
        animation: slideUpModal 0.3s ease;
    }
}

@keyframes slideUpModal {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Notificaciones móviles */
@media (max-width: 768px) {
    .notification-modern {
        padding: 16px;
        margin-bottom: 8px;
        border-radius: 12px;
        font-size: 14px;
    }
    
    #corporate-notif-popup {
        top: 60px !important;
        right: 16px !important;
        left: 16px !important;
        width: auto !important;
        min-width: auto !important;
        max-width: none !important;
    }
}

/* Navegación inferior móvil */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 0, 0, 0.2);
    padding: 8px 0;
    z-index: 1000;
    safe-area-inset-bottom: env(safe-area-inset-bottom);
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: block;
    }
    
    .mobile-bottom-nav ul {
        display: flex;
        justify-content: space-around;
        align-items: center;
        list-style: none;
        margin: 0;
        padding: 0;
    }
    
    .mobile-bottom-nav li {
        flex: 1;
        text-align: center;
    }
    
    .mobile-bottom-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 8px;
        color: rgba(255, 255, 255, 0.7);
        text-decoration: none;
        font-size: 12px;
        min-height: var(--touch-target-comfortable);
        justify-content: center;
        border-radius: 8px;
        transition: all var(--mobile-transition-fast);
    }
    
    .mobile-bottom-nav a.active,
    .mobile-bottom-nav a:hover {
        color: #FF0000;
        background: rgba(255, 0, 0, 0.1);
    }
    
    .mobile-bottom-nav .icon {
        font-size: 20px;
    }
    
    /* Añadir padding bottom al contenido para la navegación inferior */
    main {
        padding-bottom: 80px;
    }
}

/* Gestos táctiles */
@media (max-width: 768px) {
    /* Pull to refresh */
    .pull-to-refresh {
        position: relative;
        overflow: hidden;
    }
    
    .pull-to-refresh-indicator {
        position: absolute;
        top: -60px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: rgba(255, 0, 0, 0.1);
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all var(--mobile-transition-normal);
    }
    
    .pull-to-refresh.pulling .pull-to-refresh-indicator {
        top: 20px;
    }
    
    /* Swipe gestures */
    .swipeable {
        position: relative;
        overflow: hidden;
        touch-action: pan-y;
    }
    
    .swipe-actions {
        position: absolute;
        top: 0;
        right: 0;
        height: 100%;
        display: flex;
        align-items: center;
        background: #FF0000;
        padding: 0 20px;
        transform: translateX(100%);
        transition: transform var(--mobile-transition-normal);
    }
    
    .swipeable.swiped .swipe-actions {
        transform: translateX(0);
    }
}

/* Optimizaciones de rendimiento móvil */
@media (max-width: 768px) {
    /* Reducir animaciones en móviles lentos */
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
    
    /* Optimizar imágenes */
    img {
        max-width: 100%;
        height: auto;
        object-fit: cover;
        border-radius: 8px;
    }
    
    /* Lazy loading mejorado */
    img[data-src] {
        background: linear-gradient(90deg, #1C1C1C 25%, #2A2A2A 50%, #1C1C1C 75%);
        background-size: 200% 100%;
        animation: loading 1.5s infinite;
    }
    
    @keyframes loading {
        0% { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }
}

/* Mejoras de accesibilidad móvil */
@media (max-width: 768px) {
    /* Aumentar contraste en móvil */
    .high-contrast {
        filter: contrast(1.2);
    }
    
    /* Mejorar focus para navegación por teclado */
    *:focus {
        outline: 2px solid #FF0000;
        outline-offset: 2px;
    }
    
    /* Texto más legible */
    p, span, div {
        line-height: 1.6;
        letter-spacing: 0.01em;
    }
}

/* Estados de carga móvil */
@media (max-width: 768px) {
    .mobile-loading {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 40px 20px;
        text-align: center;
    }
    
    .mobile-loading-spinner {
        width: 40px;
        height: 40px;
        border: 3px solid rgba(255, 0, 0, 0.3);
        border-top: 3px solid #FF0000;
        border-radius: 50%;
        animation: spin 1s linear infinite;
        margin-bottom: 16px;
    }
    
    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
    
    .mobile-loading-text {
        color: rgba(255, 255, 255, 0.8);
        font-size: 14px;
    }
}

/* Mejoras específicas para iOS */
@supports (-webkit-touch-callout: none) {
    /* Safe area para iPhone X+ */
    .corporate-header {
        padding-top: max(12px, env(safe-area-inset-top));
    }
    
    .mobile-bottom-nav {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
    
    /* Mejorar scroll en iOS */
    .scroll-container {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
    }
}

/* Mejoras específicas para Android */
@media (max-width: 768px) and (orientation: portrait) {
    /* Optimizaciones para pantallas Android */
    .android-optimized {
        will-change: transform;
        transform: translateZ(0);
    }
}

/* Orientación landscape en móvil */
@media (max-width: 768px) and (orientation: landscape) {
    .corporate-header {
        padding: 8px 16px;
    }
    
    .corporate-logo {
        font-size: 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .mobile-bottom-nav {
        display: none; /* Ocultar en landscape */
    }
    
    main {
        padding-bottom: 20px; /* Reducir padding en landscape */
    }
}

/* Dark mode específico para móvil */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
    :root {
        --mobile-bg: #000000;
        --mobile-card-bg: #1A1A1A;
        --mobile-text: #FFFFFF;
    }
    
    body {
        background: var(--mobile-bg);
        color: var(--mobile-text);
    }
}

/* Utilidades móviles */
@media (max-width: 768px) {
    .mobile-only { display: block !important; }
    .desktop-only { display: none !important; }
    .mobile-hidden { display: none !important; }
    
    .mobile-full-width { width: 100% !important; }
    .mobile-text-center { text-align: center !important; }
    .mobile-text-left { text-align: left !important; }
    
    .mobile-p-4 { padding: 16px !important; }
    .mobile-m-4 { margin: 16px !important; }
    .mobile-gap-2 { gap: 8px !important; }
    
    .mobile-text-sm { font-size: 14px !important; }
    .mobile-text-base { font-size: 16px !important; }
    .mobile-text-lg { font-size: 18px !important; }
}

/* Mejoras de performance */
@media (max-width: 768px) {
    /* GPU acceleration para elementos animados */
    .glass-card,
    .btn-futuristic,
    .modal-content,
    .notification-modern {
        will-change: transform;
        transform: translateZ(0);
    }
    
    /* Optimizar repaints */
    .scroll-container {
        contain: layout style paint;
    }
}