/* ==========================================
   MOBILE RESPONSIVE OVERRIDES
   Load this LAST after all other CSS files
   ========================================== */

/* --- Hamburger / sidebar toggle button (added by responsive.css) --- */
.hamburger-btn,
.sidebar-toggle-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    color: var(--dark, #0f172a);
    align-items: center;
    justify-content: center;
}
.hamburger-btn:hover,
.sidebar-toggle-btn:hover {
    background: rgba(0,0,0,0.05);
}
.hamburger-btn svg,
.sidebar-toggle-btn svg {
    width: 24px;
    height: 24px;
}

/* --- Mobile nav overlay --- */
.mobile-nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.mobile-nav-overlay.open {
    opacity: 1;
    pointer-events: auto;
}
.mobile-nav-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 80vw;
    background: #fff;
    z-index: 10000;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}
.mobile-nav-panel.open {
    transform: translateX(0);
}
.mobile-nav-panel .close-btn {
    align-self: flex-end;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    color: var(--dark, #0f172a);
}
.mobile-nav-panel .close-btn:hover {
    background: rgba(0,0,0,0.05);
}
.mobile-nav-panel .nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.mobile-nav-panel .nav-list a,
.mobile-nav-panel .nav-list .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    color: var(--dark, #0f172a);
    font-weight: 500;
    font-size: 1rem;
    text-decoration: none;
}
.mobile-nav-panel .nav-list a:hover,
.mobile-nav-panel .nav-list .nav-link:hover {
    background: rgba(99,102,241,0.08);
    color: var(--primary, #6366f1);
}
.mobile-nav-panel .nav-actions-mobile {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border, #e2e8f0);
}

/* --- Sidebar off-canvas (for profile.html, admin/dashboard.html) --- */
.sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.sidebar-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}
.sidebar.open {
    transform: translateX(0) !important;
}

/* --- Fix dashboard-container for sidebar layout --- */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar desktop rules (previously missing from dashboard.css) --- */
.sidebar {
    width: 260px;
    min-width: 260px;
    background: #0f172a;
    padding: 28px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease, width 0.3s ease, min-width 0.3s ease;
    z-index: 100;
}

.main-content {
    flex: 1;
    min-width: 0;
}

/* ========== BREAKPOINT: max 992px ========== */
@media (max-width: 992px) {
    /* Collapse sidebar to icon mode (keep existing dashboard.css rules) */
    .sidebar {
        width: 80px;
        min-width: 80px;
        padding: 20px 10px;
        align-items: center;
    }
    .sidebar-logo span,
    .sidebar-logo h2,
    .sidebar-item-text,
    .user-details {
        display: none;
    }
    .sidebar-item a {
        justify-content: center;
        padding: 12px;
    }
    .main-content {
        padding: 24px;
    }
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }
    .quick-stats {
        grid-template-columns: 1fr !important;
    }

    /* Dashboard header */
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ========== BREAKPOINT: max 768px ========== */
@media (max-width: 768px) {
    /* --- Main site header (style.css pattern: index.html, jobs.html) --- */
    header#main-header .nav-menu,
    header#main-header .nav-actions {
        display: none;
    }
    header#main-header .hamburger-btn {
        display: flex;
    }

    /* --- Dashboard header (header.css pattern: dashboard.html, payment.html) --- */
    .left .header-nav {
        display: none;
    }
    header .hamburger-btn {
        display: flex;
    }

    /* Search area: wrap on mobile */
    header .search-area {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    header .search-box {
        min-width: 160px !important;
        flex: 1;
    }
    header .header-balance {
        min-width: auto !important;
        padding: 8px 12px !important;
    }
    header .header-balance .balance-summary-amount {
        font-size: 0.85rem;
    }

    /* Sidebar: hide off-canvas */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 260px;
        min-width: 260px;
        transform: translateX(-100%);
        z-index: 999;
        height: 100vh;
        align-items: stretch;
        padding: 28px 16px;
    }
    .sidebar-logo span,
    .sidebar-item-text,
    .user-details {
        display: flex !important;
    }
    .sidebar-item a {
        justify-content: flex-start;
        padding: 12px 16px;
    }
    .sidebar-backdrop {
        display: block;
    }
    .sidebar-toggle-btn {
        display: inline-flex;
    }

    /* Sidebar pages: remove margin-left from main-content when sidebar hidden */
    .main-content {
        margin-left: 0 !important;
        padding: 20px 16px !important;
        width: 100% !important;
    }

    /* Auth pages */
    .auth-page {
        padding: 100px 16px 40px !important;
    }
    .auth-card {
        padding: 28px 20px !important;
        border-radius: 16px !important;
    }
    .auth-title {
        font-size: 1.5rem !important;
    }

    /* Hero section */
    .hero {
        padding: 120px 0 60px !important;
    }
    .hero-title {
        font-size: 2rem !important;
    }
    .hero-stats {
        flex-wrap: wrap;
        gap: 16px !important;
    }
    .hero-stats .stat-item {
        flex: 1;
        min-width: 100px;
    }
    .hero-grid {
        gap: 32px !important;
    }
    .hero-image-wrapper {
        display: none;
    }

    /* Section grids */
    .steps-grid,
    .about-grid,
    .jobs-grid {
        grid-template-columns: 1fr !important;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 32px !important;
    }
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    /* Dashboard / payment pages */
    .payment-page {
        padding: 16px !important;
    }
    .payment-panel {
        padding: 20px !important;
    }
    .payment-panel__intro {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .payment-methods-grid {
        grid-template-columns: 1fr !important;
    }

    /* Dashboard job cards */
    .job-card-db {
        padding: 16px !important;
    }
    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    /* Admin */
    .admin-grid-5 {
        grid-template-columns: 1fr 1fr !important;
    }
    .admin-table {
        font-size: 0.8rem;
    }
    .admin-table th,
    .admin-table td {
        padding: 10px 8px !important;
    }

    /* Tables: horizontal scroll wrapper */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Cards and containers */
    .welcome-card,
    .status-card {
        padding: 24px !important;
    }
    .unlock-card {
        padding: 20px !important;
    }

    /* Dashboard stats */
    .quick-stats {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Onboarding */
    .onboarding-container {
        padding: 80px 16px 40px !important;
    }
    .onboarding-card {
        padding: 28px 20px !important;
    }

    /* Page shells */
    .page-shell {
        padding: 24px 16px 48px !important;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .page-title {
        font-size: 1.5rem !important;
    }
}

/* ========== BREAKPOINT: max 480px ========== */
@media (max-width: 480px) {
    /* Header: hide logo text, shrink search */
    header .logo-text {
        display: none;
    }
    header .search-box {
        min-width: 120px !important;
    }
    header .search-box input {
        font-size: 0.85rem;
    }
    header .header-balance {
        padding: 6px 10px !important;
    }
    header .header-balance .balance-summary-amount {
        font-size: 0.8rem;
    }
    header .icon-btn {
        width: 36px;
        height: 36px;
    }
    header .icon-btn svg {
        width: 18px;
        height: 18px;
    }

    /* Sidebar: reduce width */
    .sidebar {
        width: 240px;
        min-width: 240px;
    }

    /* Main content tighter padding */
    .main-content {
        padding: 16px 12px !important;
    }

    /* Hero */
    .hero-title {
        font-size: 1.6rem !important;
    }
    .hero-desc {
        font-size: 0.9rem !important;
    }
    .hero-badge {
        font-size: 0.75rem !important;
    }
    .hero-buttons .btn {
        padding: 10px 20px !important;
        font-size: 0.85rem !important;
    }
    .hero-stats .stat-item h3 {
        font-size: 1.3rem !important;
    }

    /* Auth cards */
    .auth-page {
        padding: 80px 12px 32px !important;
    }
    .auth-card {
        padding: 24px 16px !important;
    }

    /* Dashboard grid -> single column */
    .quick-stats {
        grid-template-columns: 1fr !important;
    }
    .admin-grid-5 {
        grid-template-columns: 1fr !important;
    }

    /* Job cards */
    .job-card-db {
        padding: 14px !important;
    }
    .job-card-db .job-info-left {
        width: 100% !important;
    }
    .job-card-db .job-actions-right {
        width: 100% !important;
        flex-direction: column;
        align-items: stretch !important;
    }
    .job-card-db .job-actions-right .btn {
        width: 100%;
        text-align: center;
    }

    /* Page title */
    .page-title h1 {
        font-size: 1.3rem !important;
    }

    /* Payment form */
    .payment-summary-card {
        padding: 16px !important;
    }
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    /* Welcome / status cards */
    .welcome-card,
    .status-card {
        padding: 20px !important;
        border-radius: 16px !important;
    }
    .welcome-card h2 {
        font-size: 1.2rem !important;
    }

    /* Unlock card */
    .unlock-card {
        padding: 16px !important;
    }

    /* Tables */
    .admin-table th,
    .admin-table td {
        padding: 8px 6px !important;
        font-size: 0.75rem;
    }

    /* Container */
    .container {
        padding: 0 16px !important;
    }

    /* Search in public site */
    .search-box {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Modal */
    .modal-overlay {
        padding: 12px !important;
    }
    .modal-content {
        padding: 24px 16px !important;
    }

    /* Mobile nav panel */
    .mobile-nav-panel {
        width: 260px;
    }
}

/* ========== SIDEBAR TOGGLE BUTTON IN MAIN CONTENT ========== */
.sidebar-toggle-header {
    display: none;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
@media (max-width: 768px) {
    .sidebar-toggle-header {
        display: flex;
    }
}
