/**
 * LA OFICINA - Mobile Improvements v2.3
 * Diseñado por: Aria (UX Designer) + Laia (fixes)
 * Actualizado: 2026-02-07
 * 
 * FIXES v2.3:
 * - 🔥 FIX: Modal fantasma en iPhone (ocultar cuando no activo)
 * - 🔥 FIX: Clicks bloqueados en task cards
 * - Modales forzados a 1 COLUMNA en móvil
 * 
 * NOTA: Usamos !important para sobrescribir estilos inline del HTML
 */

/* ==================== 🚨 CRITICAL iOS FIXES ==================== */

/* Ocultar SOLO los modales cuando tienen display:none */
.modal-overlay[style*="display: none"],
.modal-overlay[style*="display:none"] {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    position: fixed !important;
    top: -9999px !important;
    left: -9999px !important;
}

/* Fix para bottom-sheet fantasma */
.bottom-sheet:not(.active) {
    transform: translateY(100%) !important;
    pointer-events: none !important;
}

/* Safe area para iPhone (notch + home indicator) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .main-content {
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }
    
    /* FAB con safe area */
    .fab-container,
    .mobile-nav-toggle {
        bottom: calc(20px + env(safe-area-inset-bottom)) !important;
    }
}

/* Asegurar que las task-cards sean clickeables */
.task-card {
    position: relative;
    z-index: 1;
    cursor: pointer;
}

/* Modales solo visibles cuando activos */
.modal-overlay {
    z-index: 1000;
}

/* ==================== MOBILE-FIRST BREAKPOINTS ==================== */
/* xs: <480px | sm: 480-768px | md: 768-1024px | lg: >1024px */

/* ==================== 🔥 FIX: MODALES 1 COLUMNA EN MÓVIL ==================== */
@media (max-width: 768px) {
    /* Modales fullscreen */
    .modal-overlay {
        padding: 0 !important;
        align-items: stretch !important;
    }
    
    .modal {
        max-width: 100% !important;
        max-height: 100vh !important;
        height: 100vh !important;
        border-radius: 0 !important;
        border: none !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    .modal-header {
        padding: 1rem;
        position: sticky;
        top: 0;
        background: var(--bg-secondary);
        z-index: 10;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
        flex-shrink: 0;
    }
    
    .modal-title {
        font-size: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex: 1;
    }
    
    /* 🎯 FORZAR 1 COLUMNA EN TODOS LOS GRIDS DEL MODAL */
    .modal-body [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    
    .modal-body div[style*="display: grid"] {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
    
    /* Asegurar que TODOS los elementos con grid sean 1 columna */
    .modal-body .form-grid,
    .modal-body .grid,
    .modal-body [class*="grid"] {
        grid-template-columns: 1fr !important;
        display: grid !important;
    }
    
    .modal-footer {
        padding: 1rem;
        position: sticky;
        bottom: 0;
        background: var(--bg-secondary);
        box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3);
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    /* Botones del footer en columna */
    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* 🎯 MODAL DE PROYECTOS - Layout responsive */
    .modal form > div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* En móvil, las columnas del modal de proyectos se apilan */
    .modal form > div[style*="display: grid"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Quitar border-left en móvil para la columna derecha */
    .modal form > div > div[style*="border-left"] {
        border-left: none !important;
        border-top: 1px solid var(--border) !important;
        padding-top: 1rem !important;
    }
}

/* ==================== HEADER MÓVIL OPTIMIZADO ==================== */
@media (max-width: 768px) {
    .header {
        padding: 0.75rem 0;
        margin-bottom: 1rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .header h1,
    .header .header-title {
        display: none !important;
    }
    
    /* Botón hamburguesa mejorado */
    #mobile-menu-toggle {
        width: 44px;
        height: 44px;
        min-width: 44px;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        background: var(--bg-tertiary);
        border: 1px solid var(--border);
        border-radius: 0.5rem;
        color: var(--text-primary);
        font-size: 1.25rem;
        padding: 0;
        transition: all 0.2s;
    }
    
    #mobile-menu-toggle:active {
        transform: scale(0.95);
        background: var(--accent-primary);
        color: white;
    }
}

/* ==================== KANBAN MÓVIL MEJORADO ==================== */
@media (max-width: 768px) {
    .kanban-board {
        display: flex;
        gap: 0.75rem;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 1rem;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }
    
    .kanban-column {
        min-width: 85vw;
        max-width: 85vw;
        flex-shrink: 0;
        scroll-snap-align: start;
        padding: 0.875rem;
    }
    
    .kanban-header {
        margin-bottom: 0.75rem;
    }
    
    .kanban-title {
        font-size: 0.875rem;
    }
    
    .kanban-tasks {
        gap: 0.625rem;
        max-height: calc(100vh - 350px);
    }
}

/* Scroll indicators para kanban */
@media (max-width: 768px) {
    .kanban-board::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 1rem;
        width: 40px;
        background: linear-gradient(to left, var(--bg-primary), transparent);
        pointer-events: none;
    }
}

/* ==================== TASK CARDS TÁCTILES ==================== */
/* Tamaño adaptable al contenido - nunca comprimirse */
.task-card {
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0.3rem;
    cursor: pointer;
    /* No permitir que se comprima */
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .task-card {
        padding: 0.875rem;
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(74, 158, 255, 0.1);
    }
    
    .task-card:active {
        transform: scale(0.98);
        background: var(--bg-tertiary);
    }
    
    .task-title {
        font-size: 0.875rem;
        line-height: 1.4;
    }
    
    /* Botones de acción rápida más grandes */
    .task-card-actions {
        display: flex;
        gap: 0.5rem;
        margin-top: 0.625rem;
        padding-top: 0.625rem;
        border-top: 1px solid var(--border);
    }
    
    .task-action-btn {
        flex: 1;
        padding: 0.5rem;
        min-height: 40px;
        font-size: 0.8rem;
        border-radius: 0.5rem;
        background: var(--bg-tertiary);
        border: 1px solid var(--border);
        color: var(--text-secondary);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
        transition: all 0.2s;
    }
    
    .task-action-btn:active {
        transform: scale(0.95);
        background: var(--accent-primary);
        color: white;
        border-color: var(--accent-primary);
    }
}

/* ==================== STATS GRID MÓVIL ==================== */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 0.875rem;
    }
    
    .stat-label {
        font-size: 0.65rem;
        margin-bottom: 0.375rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        /* 5 estadísticas en horizontal sin scroll */
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: hidden !important;
        gap: 0.25rem !important;
        padding: 0 !important;
        width: 100% !important;
    }
    
    .stats-grid .stat-card {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        max-width: none !important;
        padding: 0.375rem 0.25rem !important;
        text-align: center !important;
    }
    
    .stats-grid .stat-label {
        font-size: 0.5rem !important;
        margin-bottom: 0.125rem !important;
        line-height: 1.1 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    .stats-grid .stat-value {
        font-size: 1rem !important;
        line-height: 1.2 !important;
    }
}

/* ==================== FORMULARIOS MÓVILES ==================== */
@media (max-width: 768px) {
    .form-group {
        margin-bottom: 0.875rem;
    }
    
    .form-label {
        font-size: 0.813rem;
        font-weight: 500;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        padding: 0.75rem !important;
        font-size: 16px !important; /* Evita zoom en iOS */
        min-height: 44px !important;
        border-radius: 0.5rem !important;
        width: 100% !important;
    }
    
    .form-textarea {
        min-height: 120px !important;
    }
    
    /* Botones de formulario más grandes y apilados */
    .btn {
        min-height: 44px;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        width: 100%;
        justify-content: center;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 0.5rem 0.75rem;
    }
    
    /* Grupos de botones en columna */
    .button-group,
    .form-actions,
    .modal-footer {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .button-group .btn,
    .form-actions .btn {
        width: 100%;
    }
}

/* ==================== APP LAYOUT MÓVIL ==================== */
@media (max-width: 768px) {
    .app {
        grid-template-columns: 1fr !important;
    }
    
    .main {
        padding: 1rem !important;
        width: 100% !important;
    }
    
    /* Dashboard grid a 1 columna */
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ==================== SIDEBAR MÓVIL MEJORADO ==================== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -100% !important;
        width: 85vw !important;
        max-width: 320px !important;
        height: 100vh !important;
        z-index: 1001 !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.5) !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    .sidebar.open {
        left: 0 !important;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.7);
        z-index: 1000;
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
    }
    
    .sidebar-overlay.active {
        display: block;
        animation: fadeIn 0.2s ease;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
    
    /* Nav links más táctiles */
    .nav-link {
        min-height: 44px;
        padding: 0.75rem 1rem;
        font-size: 0.938rem;
    }
}

/* ==================== BOTONES FLOTANTES PARA ACCIONES RÁPIDAS ==================== */
@media (max-width: 768px) {
    .fab-container {
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 999;
        display: flex;
        flex-direction: column-reverse;
        gap: 0.75rem;
        align-items: flex-end;
    }
    
    .fab {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--accent-primary);
        color: white;
        border: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
        font-size: 1.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s;
        -webkit-tap-highlight-color: transparent;
    }
    
    .fab:active {
        transform: scale(0.9);
    }
    
    .fab-mini {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
        background: var(--bg-elevated);
        border: 1px solid var(--border);
    }
    
    .fab-actions {
        display: none;
        flex-direction: column-reverse;
        gap: 0.5rem;
    }
    
    .fab-actions.active {
        display: flex;
        animation: slideUp 0.2s ease;
    }
    
    @keyframes slideUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* ==================== BOTTOM SHEETS PARA ACCIONES ==================== */
@media (max-width: 768px) {
    .bottom-sheet {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        border-top-left-radius: 1rem;
        border-top-right-radius: 1rem;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1002;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.5);
        max-height: 85vh;
        overflow-y: auto;
    }
    
    .bottom-sheet.active {
        transform: translateY(0);
    }
    
    .bottom-sheet-handle {
        width: 36px;
        height: 4px;
        background: var(--border);
        border-radius: 2px;
        margin: 0.75rem auto 0;
    }
    
    .bottom-sheet-content {
        padding: 1rem;
    }
    
    .bottom-sheet-actions {
        display: grid;
        gap: 0.5rem;
        padding: 1rem 0;
    }
    
    .bottom-sheet-action {
        display: flex;
        align-items: center;
        gap: 1rem;
        padding: 1rem;
        background: var(--bg-tertiary);
        border: 1px solid var(--border);
        border-radius: 0.5rem;
        color: var(--text-primary);
        font-size: 0.938rem;
        min-height: 56px;
        cursor: pointer;
        transition: all 0.2s;
    }
    
    .bottom-sheet-action:active {
        background: var(--bg-elevated);
        transform: scale(0.98);
    }
    
    .bottom-sheet-action-icon {
        font-size: 1.5rem;
        width: 32px;
        text-align: center;
    }
}

/* ==================== OPTIMIZACIONES DE RENDIMIENTO ==================== */
@media (max-width: 768px) {
    /* Hardware acceleration para animaciones suaves */
    .sidebar,
    .modal,
    .bottom-sheet,
    .task-card {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: transform;
    }
    
    /* Smooth scrolling nativo */
    .kanban-board,
    .kanban-tasks,
    .modal-body {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
}

/* ==================== PULL TO REFRESH INDICATOR ==================== */
@media (max-width: 768px) {
    .pull-to-refresh {
        position: relative;
    }
    
    .pull-indicator {
        position: absolute;
        top: -60px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--text-secondary);
        font-size: 1.5rem;
        transition: top 0.2s;
    }
    
    .pull-indicator.active {
        top: 10px;
    }
}

/* ==================== TOAST MÓVIL ==================== */
@media (max-width: 768px) {
    #global-toast {
        left:50%;
        top: 20px !important;
        transform:translateX(-50%);
        max-width: calc(100vw - 2rem);
        top: auto;
    }
}

/* ==================== ACCESIBILIDAD TÁCTIL ==================== */
@media (max-width: 768px) {
    /* Área táctil mínima de 44x44px para todos los elementos interactivos */
    button,
    .btn,
    .nav-link,
    .task-card,
    .stat-card,
    a {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Mayor espaciado entre elementos táctiles */
    .button-group button {
        margin: 0.25rem 0;
    }
    
    /* Feedback táctil visual */
    button:active,
    .btn:active,
    .nav-link:active {
        opacity: 0.7;
    }
}

/* ==================== DARK MODE FIXES PARA MÓVIL ==================== */
@media (max-width: 768px) {
    /* Ajuste de brillo para OLED */
    body {
        background: #000;
    }
    
    .card,
    .stat-card,
    .task-card {
        border-color: #1a1a1a;
    }
}

/* ==================== LANDSCAPE MODE ==================== */
@media (max-width: 768px) and (orientation: landscape) {
    .kanban-column {
        min-width: 45vw;
        max-width: 45vw;
    }
    
    .modal {
        max-height: 95vh;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* ==================== TABLET OPTIMIZATIONS ==================== */
@media (min-width: 768px) and (max-width: 1024px) {
    .kanban-board {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* ==================== ESTILO MINIMALISTA MODERNO ==================== */
@media (max-width: 768px) {
    /* Reducir ruido visual */
    .card {
        border: 1px solid var(--border) !important;
        box-shadow: none !important;
    }
    
    /* Botones más modernos */
    .btn {
        border-radius: 0.5rem !important;
        font-weight: 500 !important;
        letter-spacing: 0.01em !important;
    }
    
    .btn-primary {
        background: var(--accent-primary) !important;
        border: none !important;
    }
    
    /* Inputs más limpios */
    .form-input:focus,
    .form-select:focus,
    .form-textarea:focus {
        border-color: var(--accent-primary) !important;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
        outline: none !important;
    }
}

/* ==================== MEJOR CONTRASTE Y LEGIBILIDAD ==================== */
@media (max-width: 768px) {
    /* Texto más legible */
    body {
        font-size: 15px !important;
        line-height: 1.5 !important;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    /* Títulos más claros */
    h1, h2, h3, h4, h5, h6 {
        font-weight: 600 !important;
        letter-spacing: -0.02em !important;
    }
    
    /* Mejor contraste para texto secundario */
    .text-secondary {
        opacity: 0.7 !important;
    }
}

/* ==================== ANIMACIONES SUAVES ==================== */
@media (max-width: 768px) {
    /* Preferir transiciones suaves */
    * {
        transition-duration: 0.2s !important;
        transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    
    /* Reducir motion para usuarios que lo prefieran */
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
}

/* ==================== ESPACIADO MEJORADO ==================== */
@media (max-width: 768px) {
    /* Más aire entre secciones */
    .section {
        margin-bottom: 1.5rem !important;
    }
    
    /* Padding generoso en contenedores principales */
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

/* ==================== CARDS Y LISTAS ==================== */
@media (max-width: 768px) {
    /* Forzar listas y cards a 1 columna */
    [style*="display: grid"][style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Específicamente para vistas de proyectos/agentes */
    .projects-grid,
    .agents-grid,
    .files-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ==================== 🔥 FIX: MODAL FANTASMA (iPhone) ==================== */
/* Los modales se controlan via Alpine.js x-show, no añadir reglas que interfieran */

/* Safe area padding para iPhone */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .modal-footer,
    .bottom-sheet-content,
    .main {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
    
    .fab-container,
    .floating-btn {
        bottom: calc(20px + env(safe-area-inset-bottom));
    }
}

/* ==================== 🔄 FIX: KANBAN FLUIDO ==================== */
@media (max-width: 768px) {
    .kanban-board {
        display: flex !important;
        gap: 0.5rem !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding: 0.5rem !important;
        scroll-snap-type: x mandatory !important;
        -webkit-overflow-scrolling: touch !important;
        scroll-behavior: smooth !important;
    }
    
    .kanban-column {
        min-width: 80vw !important;
        max-width: 80vw !important;
        flex-shrink: 0 !important;
        scroll-snap-align: center !important;
        padding: 0.75rem !important;
        border-radius: 0.75rem !important;
        margin: 0 !important;
    }
    
    /* Indicadores de scroll */
    .kanban-board::before,
    .kanban-board::after {
        content: '';
        min-width: 0.25rem;
        flex-shrink: 0;
    }
}

/* ==================== 📜 FIX: SCROLL EN COLUMNAS ==================== */
@media (max-width: 768px) {
    .kanban-column {
        display: flex !important;
        flex-direction: column !important;
        max-height: calc(100vh - 200px) !important;
    }
    
    .kanban-header {
        flex-shrink: 0 !important;
        padding-bottom: 0.5rem !important;
        margin-bottom: 0.5rem !important;
        border-bottom: 1px solid var(--border) !important;
    }
    
    .kanban-tasks {
        flex: 1 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        padding-right: 0.25rem !important;
        gap: 0.5rem !important;
        display: flex !important;
        flex-direction: column !important;
        overscroll-behavior: contain !important;
    }
    
    /* Scrollbar sutil */
    .kanban-tasks::-webkit-scrollbar {
        width: 4px;
    }
    
    .kanban-tasks::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 4px;
    }
}

/* ==================== 🔔 FIX: TOAST NOTIFICATIONS ==================== */
#global-toast,
.toast {
    position: fixed !important;
    z-index: 10001 !important;
    padding: 0.75rem 1rem !important;
    border-radius: 0.5rem !important;
    font-weight: 500 !important;
    font-size: 0.875rem !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

/* Desktop: Esquina superior derecha */
@media (min-width: 769px) {
    #global-toast,
    .toast {
        top: 20px !important;
        left:50%;
        transform:translateX(-50%);
        max-width: 400px !important;
    }
}

/* Móvil: Centrado y compacto */
@media (max-width: 768px) {
    #global-toast,
    .toast {
        top: 20px !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        width: auto !important;
        max-width: calc(100vw - 2rem) !important;
        min-width: 200px !important;
        text-align: center !important;
    }
}

/* Colores de toast */
.toast.success, #global-toast.success {
    background: var(--accent-success) !important;
    color: white !important;
}

.toast.error, #global-toast.error {
    background: var(--accent-danger) !important;
    color: white !important;
}

/* ==================== 🎨 FIX: DISEÑO MINIMALISTA ==================== */
/* Reducir espaciado general */
.kanban-board {
    gap: 0.75rem;
}

.kanban-column {
    padding: 0.875rem;
}

.kanban-header {
    margin-bottom: 0.625rem;
    padding-bottom: 0.5rem;
}

.kanban-title {
    font-size: 0.8rem;
    font-weight: 600;
}

.task-card {
    padding: 0.75rem;
}

.kanban-tasks {
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .kanban-board {
        gap: 0.375rem !important;
    }
    
    .kanban-column {
        min-width: 85vw !important;
        padding: 0.625rem !important;
    }
}

/* ==================== 📱 iOS SAFE AREAS ==================== */
@supports (padding: max(0px)) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    .sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .modal-footer {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* Prevenir Zoom en Inputs iOS */
input, select, textarea {
    font-size: 16px !important;
}

/* Rubber Band Scrolling */
html, body {
    overscroll-behavior: none;
}

.kanban-board {
    overscroll-behavior-x: contain;
}

/* ==================== 🔧 FIX: MODAL DE TAREAS EN MÓVIL (v2.4) ==================== */
@media (max-width: 768px) {
    /* El modal de tareas tiene max-width: 900px en desktop */
    .modal[style*="max-width: 900px"] {
        max-width: 100% !important;
    }
}