/* === MOBILE RESPONSIVE OPTIMIZATIONS === */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 280px;
    }
    
    /* Hide topbar sidebar toggle */
    .mobile-menu-toggle {
        display: none !important;
    }

    /* Topbar adjustments */
    header.topbar {
        position: sticky;
        top: 0;
        z-index: 900;
        background: rgba(15, 23, 42, 0.9);
        backdrop-filter: blur(10px);
        padding: 0.5rem 1rem;
        height: 60px;
        border-bottom: 1px solid var(--border-glass);
    }
    
    aside {
        transform: translateX(-100%);
        z-index: 1000;
    }
    
    aside.mobile-active {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0,0,0,0.8);
    }
    
    main {
        margin-left: 0;
        padding-bottom: 70px; /* Space for bottom nav */
    }
    
    .content-wrapper {
        padding: 1rem;
    }
    
    .stat-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    
    .form-group-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    /* Bottom Navigation */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 65px;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(12px);
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        z-index: 999;
        justify-content: space-around;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: #64748b;
        text-decoration: none;
        flex: 1;
        gap: 4px;
        transition: all 0.3s;
        cursor: pointer;
    }

    .bottom-nav-item i {
        width: 22px;
        height: 22px;
        transition: transform 0.3s;
    }

    .bottom-nav-item span {
        font-size: 11px;
        font-weight: 500;
    }

    .bottom-nav-item.active {
        color: #38bdf8;
    }

    .bottom-nav-item.active i {
        transform: translateY(-2px);
    }
    
    /* Card-based Table View */
    .table-container {
        border: none;
        background: transparent;
        border-radius: 0;
        padding: 0;
    }
    
    table.data-table {
        display: block;
        width: 100%;
        background: transparent;
    }
    
    table.data-table thead { 
        display: none;
    }
    
    table.data-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }
    
    table.data-table tr {
        display: flex;
        flex-direction: column;
        background: rgba(30, 41, 59, 0.6);
        border: 1px solid rgba(255,255,255,0.05);
        border-radius: 12px;
        padding: 12px;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }
    
    table.data-table td { 
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px dashed rgba(255,255,255,0.05);
        text-align: right;
    }
    
    table.data-table td:last-child {
        border-bottom: none;
        padding-bottom: 0;
        margin-top: 8px;
        padding-top: 12px;
        justify-content: flex-end;
        gap: 8px;
    }
    
    table.data-table td::before { 
        content: attr(data-label);
        font-size: 12px;
        font-weight: 600;
        color: #94a3b8;
        text-align: left;
        margin-right: 12px;
    }
    
    .actions-cell {
        justify-content: flex-end;
    }
    
    /* Modal Fullscreen on Mobile */
    .modal-window {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        transform: translateY(100%);
        transition: transform 0.3s ease-out;
    }
    
    .modal-overlay.active .modal-window {
        transform: translateY(0);
    }
    
    .modal-body {
        flex: 1;
        overflow-y: auto;
    }
    
    /* Overlay for Sidebar */
    .sidebar-overlay {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        backdrop-filter: blur(2px);
        z-index: 999;
        display: none;
        opacity: 0;
        transition: opacity 0.3s;
    }
    
    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }
}

@media (min-width: 769px) {
    .bottom-nav {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .stat-grid {
        grid-template-columns: 1fr;
    }
    
    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-wrapper {
        max-width: 100%;
    }
    
    .btn {
        justify-content: center;
    }
}
