/*
 * Estilos responsive para TeamFlow
 * Optimizado para móviles y tablets
 */

/* === MOBILE FIRST (< 768px) === */

/* Navbar mejoras para móvil */
@media (max-width: 767px) {
    .navbar-brand {
        font-size: 1rem;
    }

    .navbar-brand img {
        height: 24px !important;
    }

    .nav-link {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #e5e7eb;
    }

    .navbar-collapse {
        margin-top: 0.5rem;
    }
}

/* Tablas responsive */
@media (max-width: 767px) {
    .table-responsive {
        border: 0;
    }

    .table thead {
        display: none;
    }

    .table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e5e7eb;
        border-radius: 0.375rem;
        padding: 0.75rem;
        background: white;
    }

    .table tbody td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
        border: 0;
        border-bottom: 1px solid #f3f4f6;
    }

    .table tbody td:last-child {
        border-bottom: 0;
    }

    .table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 1rem;
    }
}

/* Botones más grandes en móvil */
@media (max-width: 767px) {
    .btn-sm {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    .btn {
        padding: 0.625rem 1.25rem;
    }
}

/* Formularios responsive */
@media (max-width: 767px) {
    .row > [class*='col-'] {
        margin-bottom: 1rem;
    }

    .form-control,
    .form-select {
        font-size: 16px; /* Previene zoom en iOS */
    }

    /* Stack de filtros en móvil */
    .filter-row .col-md-2,
    .filter-row .col-md-3,
    .filter-row .col-md-4 {
        margin-bottom: 0.75rem;
    }
}

/* Cards más compactos en móvil */
@media (max-width: 767px) {
    .card {
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .card-header {
        padding: 0.75rem 1rem;
    }
}

/* Modales full-screen en móvil */
@media (max-width: 767px) {
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100vh;
    }

    .modal-content {
        height: 100vh;
        border-radius: 0;
        border: 0;
    }

    .modal-body {
        overflow-y: auto;
    }
}

/* Kanban responsive */
@media (max-width: 767px) {
    .kanban-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 1rem;
    }

    .kanban-column {
        min-width: 280px;
        margin-right: 0.75rem;
    }

    .kanban-card {
        font-size: 0.875rem;
    }
}

/* Gantt responsive */
@media (max-width: 767px) {
    .gantt-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #gantt-chart {
        min-width: 800px;
    }
}

/* Listado de tareas responsive */
@media (max-width: 767px) {
    .task-item {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .task-item .badge,
    .task-item .text-muted {
        margin-top: 0.5rem;
    }

    .task-actions {
        width: 100%;
        margin-top: 0.75rem;
        display: flex;
        gap: 0.5rem;
    }

    .task-actions .btn {
        flex: 1;
    }
}

/* Chatter/Comentarios responsive */
@media (max-width: 767px) {
    .chatter-container {
        padding: 0.75rem;
    }

    .comentario-item {
        flex-direction: column;
    }

    .comentario-avatar {
        margin-bottom: 0.5rem;
    }
}

/* Ocultar textos largos en móvil */
@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }

    .text-truncate-mobile {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 200px;
    }
}

/* === TABLET (768px - 991px) === */

@media (min-width: 768px) and (max-width: 991px) {
    .navbar-brand {
        font-size: 1.1rem;
    }

    .kanban-column {
        min-width: 240px;
    }
}

/* === DESKTOP (> 992px) === */

@media (min-width: 992px) {
    /* Asegurar que las columnas tengan altura completa */
    .row-eq-height {
        display: flex;
        flex-wrap: wrap;
    }

    .row-eq-height > [class*='col-'] {
        display: flex;
        flex-direction: column;
    }
}

/* === UTILIDADES === */

/* Espaciado touch-friendly */
.touch-target {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Scroll suave en contenedores */
.smooth-scroll {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Prevenir selección accidental en móvil */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Separadores responsive */
.separator-mobile {
    display: none;
}

@media (max-width: 767px) {
    .separator-mobile {
        display: block;
        height: 1px;
        background-color: #e5e7eb;
        margin: 1rem 0;
    }
}

/* Grid responsive para cards */
@media (max-width: 767px) {
    .card-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Mejoras de accesibilidad táctil */
@media (max-width: 767px) {
    a, button, .btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .form-check-input {
        width: 1.5rem;
        height: 1.5rem;
    }
}
