/* Mobile Optimization Styles for Dambrosio App */

/* ============================================
   RESPONSIVE TABLES
   ============================================ */

@media (max-width: 768px) {
    /* Hide table headers on mobile */
    .mobile-responsive-table thead {
        display: none;
    }

    /* Stack table rows as cards */
    .mobile-responsive-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e2e8f0;
        border-radius: 0.75rem;
        padding: 0.75rem;
        background: white;
    }

    /* Display table cells as rows */
    .mobile-responsive-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border-bottom: 1px solid #f1f5f9;
    }

    .mobile-responsive-table tbody td:last-child {
        border-bottom: none;
    }

    /* Add labels before content */
    .mobile-responsive-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.75rem;
        color: #64748b;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    /* Action buttons full width on mobile */
    .mobile-responsive-table .action-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    .mobile-responsive-table .action-buttons a,
    .mobile-responsive-table .action-buttons button {
        width: 100%;
        text-align: center;
    }
}

/* ============================================
   KANBAN MOBILE OPTIMIZATION
   ============================================ */

@media (max-width: 1024px) {
    /* Stack Kanban columns vertically on tablet/mobile */
    .kanban-container {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .kanban-column {
        width: 100% !important;
        min-height: auto !important;
    }

    /* Horizontal scroll for Kanban on small screens */
    .kanban-horizontal-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .kanban-horizontal-scroll .kanban-container {
        flex-direction: row;
        min-width: max-content;
    }

    .kanban-horizontal-scroll .kanban-column {
        min-width: 280px;
        max-width: 320px;
    }

    /* Compact Kanban cards on mobile */
    .kanban-card {
        padding: 0.75rem !important;
    }

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

    .kanban-card .text-xs {
        font-size: 0.6875rem !important;
    }
}

/* ============================================
   MODAL OPTIMIZATION
   ============================================ */

@media (max-width: 768px) {
    /* Full screen modals on mobile */
    .modal-content {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }

    /* Modal header sticky on mobile */
    .modal-header {
        position: sticky;
        top: 0;
        z-index: 10;
        background: white;
        border-bottom: 1px solid #e2e8f0;
    }

    /* Modal footer sticky on mobile */
    .modal-footer {
        position: sticky;
        bottom: 0;
        z-index: 10;
        background: white;
        border-top: 1px solid #e2e8f0;
        padding: 1rem;
    }

    /* Scrollable modal body */
    .modal-body {
        overflow-y: auto;
        max-height: calc(100vh - 120px);
        -webkit-overflow-scrolling: touch;
    }
}

/* ============================================
   FORM OPTIMIZATION
   ============================================ */

@media (max-width: 768px) {
    /* Stack form grids on mobile */
    .form-grid-2,
    .form-grid-3,
    .form-grid-4 {
        grid-template-columns: 1fr !important;
    }

    /* Larger touch targets */
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    select,
    textarea,
    button {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Full width buttons on mobile */
    .btn-group {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-group button,
    .btn-group a {
        width: 100%;
    }
}

/* ============================================
   NAVIGATION OPTIMIZATION
   ============================================ */

@media (max-width: 768px) {
    /* Hamburger menu */
    .mobile-menu-toggle {
        display: block;
    }

    .desktop-nav {
        display: none;
    }

    .mobile-nav {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        background: white;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        transition: left 0.3s ease;
        z-index: 1000;
    }

    .mobile-nav.open {
        left: 0;
    }

    /* Mobile nav overlay */
    .mobile-nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 999;
    }

    .mobile-nav-overlay.active {
        opacity: 1;
        pointer-events: all;
    }
}

/* ============================================
   DASHBOARD CARDS
   ============================================ */

@media (max-width: 768px) {
    /* Stack dashboard cards */
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }

    /* Compact KPI cards */
    .kpi-card {
        padding: 1rem !important;
    }

    .kpi-card h3 {
        font-size: 1.25rem !important;
    }

    .kpi-card .text-xs {
        font-size: 0.6875rem !important;
    }
}

/* ============================================
   PAYMENT MANAGEMENT MOBILE
   ============================================ */

@media (max-width: 768px) {
    /* Stack payment summary cards */
    .payment-summary-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    /* Compact payment transactions */
    .payment-transaction {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .payment-transaction .payment-actions {
        width: 100%;
        margin-top: 0.5rem;
        display: flex;
        justify-content: flex-end;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Hide on mobile */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Show only on mobile */
.show-mobile {
    display: none !important;
}

@media (max-width: 768px) {
    .show-mobile {
        display: block !important;
    }
}

/* Prevent horizontal scroll */
body {
    overflow-x: hidden;
}

/* Touch-friendly spacing */
@media (max-width: 768px) {
    .touch-spacing {
        padding: 0.75rem !important;
    }

    .touch-spacing-lg {
        padding: 1rem !important;
    }
}
