/* ========================================= */
/* ===== MOBILE APP SKIN ==== */
/* ========================================= */

/* Hide mobile elements on Desktop - We need this here too just in case */
@media (min-width: 769px) {
    .mobile-bottom-nav {
        display: none !important;
    }

    .sidebar-close-btn {
        display: none !important;
    }

    .sidebar-overlay {
        display: none !important;
    }

    .btn-icon-mobile {
        display: none !important;
    }
}

/* --- Layout Shell --- */
.sidebar { 
    transform: translateX(-100%); 
    z-index: 1001; 
    width: 280px; 
    box-shadow: none;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: fixed;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevents whole sidebar scrolling, we want just the nav to scroll */
}
.sidebar.open { 
    transform: translateX(0); 
    box-shadow: 5px 0 25px rgba(0,0,0,0.5);
}

/* CRITICAL: Make the navigation scrollable on mobile */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    padding-bottom: 40px; /* Space at the bottom so items aren't cut off */
}

.sidebar-overlay {
    display: none; /* Hidden by default, .active shows it */
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s;
}
.sidebar-overlay.active { display: block; opacity: 1; }



.sidebar-close-btn { 
    display: flex !important; 
    position: absolute; top: 16px; right: 16px; 
    background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer;
    z-index: 10;
}

.main-content { 
    margin-left: 0 !important; 
    padding-bottom: 80px; /* Space for bottom nav */
}

/* --- Top Header (Fix Hamburger Alignment) --- */
.top-header {
    padding: 12px 16px;
    position: sticky;
    top: 0;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.header-left h1 { font-size: 18px; }
.header-date { display: none; }
.header-search { display: none !important; }
.profile-name { display: none !important; }
.header-notifications { display: none !important; }

/* FORCE HAMBURGER ICON ALIGNMENT */
.menu-toggle { 
    display: inline-flex !important; 
    align-items: center !important; 
    justify-content: center !important;
    width: 40px; 
    height: 40px;
    padding: 0 !important; /* Remove default padding */
    flex-shrink: 0;
}

.header-action-btn .btn-text-desktop {
    display: none;
}

.header-action-btn .btn-icon-mobile {
    display: inline-block;
}

.header-action-btn {
    padding: 8px 12px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Bottom Navigation --- */
.mobile-bottom-nav {
    display: flex !important; /* Force show on mobile */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 8px 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 999;
    box-shadow: 0 -2px 20px rgba(0,0,0,0.2);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
    padding: 0;
}

.bottom-nav-item i {
    font-size: 20px;
    transition: transform 0.2s;
}

.bottom-nav-item.active {
    color: var(--primary-light);
}

.bottom-nav-item.active i {
    transform: scale(1.1);
}

/* --- Page Content --- */
.page-content {
    padding: 16px;
}

/* --- Grids --- */
.kpi-grid,
.expense-summary {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px;
}

.kpi-card,
.summary-card {
    padding: 16px;
}

.kpi-value {
    font-size: 18px !important;
}

.kpi-badge {
    display: none;
}

.charts-grid,
.bottom-grid,
.profile-grid,
.fb-wrapper {
    grid-template-columns: 1fr !important;
}

.chart-body {
    height: 220px !important;
}

.form-row,
.ic-grid-3 {
    grid-template-columns: 1fr !important;
}

/* --- Tables (Card View on Mobile) --- */
.data-table thead {
    display: none !important;
}

.data-table tbody tr {
    display: block !important;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.data-table tbody td {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0 !important;
    border-bottom: 1px solid var(--border) !important;
    background: none !important;
}

.data-table tbody td:last-child {
    border-bottom: none !important;
}

.data-table tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-muted);
    font-size: 12px;
    margin-right: 16px;
    text-align: left;
}

.data-table .action-btns {
    justify-content: flex-end;
    margin-top: 8px;
    border-bottom: none !important;
}

.data-table .empty-table {
    display: block;
    text-align: center;
    padding: 30px 10px;
}

.data-table .empty-table::before {
    content: '';
    display: none;
}

/* --- Modals --- */
.modal-overlay {
    align-items: flex-end !important;
}

/* Slide up from bottom */
.modal {
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    max-height: 90vh;
    animation: slideUpMobile 0.3s ease forwards !important;
}

.modal-lg {
    max-width: 100% !important;
}

@keyframes slideUpMobile {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

/* --- Invoice Create Split --- */
.ic-wrapper {
    flex-direction: column !important;
    height: auto !important;
}

.ic-left {
    width: 100% !important;
    height: auto !important;
    border-right: none !important;
}

.ic-right {
    width: 100% !important;
    background: var(--bg-dark) !important;
    padding: 16px !important;
}

.preview-paper {
    transform: scale(1) !important;
    min-height: auto !important;
}

.ic-top-bar {
    padding: 12px 16px;
}

.ic-form-container {
    padding: 16px;
}

.ic-item-row {
    grid-template-columns: 1fr;
    gap: 8px;
}

/* --- Specific components --- */
.clients-grid {
    grid-template-columns: 1fr !important;
}

.projects-list {
    gap: 12px;
}

.filter-form {
    flex-wrap: wrap;
}

.filter-select,
.filter-input {
    width: 100% !important;
}

.filter-form .btn-filter,
.filter-form .btn-clear {
    width: 48%;
}

.inv-meta {
    grid-template-columns: 1fr !important;
}

.inv-meta-block {
    text-align: left !important;
}

.inv-payment {
    flex-direction: column !important;
}

/* Login Page */
.login-container {
    flex-direction: column !important;
    max-width: 100% !important;
    min-height: 100vh !important;
    border-radius: 0 !important;
}

.login-left {
    display: none !important;
}

.login-right {
    width: 100% !important;
    padding: 40px 24px !important;
}