/* ========================================
   HM EXPERT — MOBILE RESPONSIVE OVERHAUL
   Applies to: customer/* and vendor/* pages
   Breakpoints: 768px (tablet), 480px (mobile)
   ======================================== */

/* === BOTTOM NAV — Mobile Tab Bar === */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 3000;
    background: rgba(6, 6, 18, 0.97);
    /* backdrop-filter disabled for performance */
    
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 0 8px;
    height: 64px;
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media screen and (max-height: 500px) and (max-width: 900px) {
    .mobile-bottom-nav {
        display: none !important;
    }
}

.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1;
    height: 100%;
    cursor: pointer;
    color: rgba(255,255,255,0.4);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    text-decoration: none;
    transition: all 0.25s ease;
    border-radius: 12px;
    padding: 6px 2px;
    min-width: 50px;
}

.mobile-bottom-nav .nav-item i {
    font-size: 22px;
    line-height: 1;
    transition: all 0.25s ease;
}

.mobile-bottom-nav .nav-item.active,
.mobile-bottom-nav .nav-item:active {
    color: var(--primary-light);
}

.mobile-bottom-nav .nav-item.active i {
    filter: drop-shadow(0 0 8px rgba(108,99,255,0.8));
    transform: translateY(-2px);
}

/* === GLOBAL MOBILE FIXES === */

@media (max-width: 900px) {
    /* Make bottom nav show */
    .mobile-bottom-nav {
        display: flex;
    }

    /* Add padding for bottom nav */
    .dashboard-main,
    main.dashboard-main {
        padding-bottom: 70px !important;
    }

    /* Dashboard content padding */
    .dashboard-content {
        padding: 16px 12px 80px !important;
    }

    /* Topbar slim-down */
    .topbar {
        padding: 0 12px !important;
        height: 60px !important;
    }

    .topbar-title {
        font-size: 16px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }

    .topbar-subtitle {
        display: none !important;
    }

    /* Sidebar fully hidden off-screen on mobile */
    .sidebar {
        transform: translateX(-100%) !important;
        transition: transform 0.35s cubic-bezier(0.4,0,0.2,1) !important;
    }

    .sidebar.mobile-open {
        transform: translateX(0) !important;
        box-shadow: 8px 0 40px rgba(0,0,0,0.9) !important;
    }

    /* Grid overrides — stack everything on mobile */
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    /* Cards padding reduce */
    .card, .card-luxury {
        padding: 16px !important;
        border-radius: 18px !important;
    }

    .card.card-sm {
        padding: 14px !important;
    }

    /* Section titles */
    .section-title {
        font-size: 18px !important;
    }

    /* Buttons — make sure they don't overflow */
    .btn {
        white-space: nowrap;
        min-height: 42px;
    }

    .btn-sm {
        padding: 8px 14px !important;
        font-size: 12px !important;
        min-height: 36px;
    }

    /* Welcome header area */
    h1[style*="font-size: 28px"],
    h1[style*="font-size:28px"] {
        font-size: 22px !important;
    }

    /* Page header flex wrapping */
    .page-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Stats grid */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* Quick stat card — horizontal layout on mobile */
    .stat-card {
        padding: 16px 18px !important;
        border-radius: 16px !important;
    }

    /* Table: make scrollable */
    .table-responsive, .data-table-wrap {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
        width: 100%;
    }

    .data-table {
        min-width: 600px !important;
    }

    /* Amount grid: 2 columns on mobile */
    .amount-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Policy grid */
    .policy-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* === VENDOR DASHBOARD TOPBAR — MOBILE SLIM === */
@media (max-width: 900px) {

    /* Vendor topbar — hide bulky items, keep only essentials */
    #topbarVendorId {
        display: none !important;
    }

    /* Topbar shimmer sync button — icon only */
    .topbar-right > button.shimmer {
        width: 38px !important;
        height: 38px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        min-width: unset !important;
    }

    .topbar-right > button.shimmer span,
    .topbar-right > button.shimmer i:last-of-type {
        display: none !important;
    }

    /* Topbar user info glass card — compress */
    .topbar-right > div[style*="background: rgba(255"] {
        padding: 6px 10px !important;
        gap: 8px !important;
    }

    /* KYC badge — icon only on very small screens */
    #topbarKycBadge {
        padding: 4px 8px !important;
        gap: 4px !important;
    }

    /* Status select — compact or hide duplicate */
    #topbarStatusToggle {
        display: none !important;
    }
    
    /* Hide the parent div of topbarStatusToggle */
    div:has(> #topbarStatusToggle) {
        display: none !important;
    }

    /* Make the NEW status toggle compact on mobile */
    .status-toggle-wrapper {
        padding: 2px !important;
        border-radius: 12px !important;
    }
    
    #vendorLiveStatus {
        font-size: 10px !important;
        padding: 2px 14px 2px 20px !important;
        width: 85px !important;
    }
}

/* === VENDOR TOPBAR EXTREME SMALL === */
@media (max-width: 480px) {

    #topbarKycBadge {
        display: none !important;
    }

    .topbar-right > div[style*="background: rgba(255"] {
        padding: 4px 8px !important;
    }

    #topbarVendorName {
        font-size: 13px !important;
        max-width: 80px !important;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* === QUICK STATS CARDS — HORIZONTAL ON MOBILE === */
@media (max-width: 900px) {
    .grid-4[style*="margin-bottom"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }

    /* Vendor stat cards — padding */
    .card-luxury[style*="padding: 28px"] {
        padding: 16px 14px !important;
        gap: 12px !important;
    }

    .match-icon-box {
        width: 40px !important;
        height: 40px !important;
        font-size: 18px !important;
        flex-shrink: 0 !important;
    }

    /* Earnings number sizing */
    div[id="vendorEarnings"],
    div[id="vendorWalletTotal"],
    div[id="vendorRating"],
    div[id="vendorOpenJobs"] {
        font-size: 20px !important;
    }
}

/* === PARTNER BANNERS — STACK ON MOBILE === */
@media (max-width: 768px) {

    /* Partner invite banner */
    #partnerInviteBanner > div,
    #partnerStatusSection > div,
    #dashReferralBanner > div[style*="justify-content: space-between"] {
        flex-direction: column !important;
        gap: 14px !important;
        align-items: flex-start !important;
    }

    /* Offer banners */
    #dynamicOfferBanner > div[style*="justify-content: space-between"],
    #promotionalBanner {
        flex-direction: column !important;
        gap: 12px !important;
    }
}

/* === CUSTOMER DASHBOARD SPECIFICS === */
@media (max-width: 768px) {

    /* Welcome section stack */
    div[style*="justify-content: space-between"][style*="flex-wrap: wrap"] {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    /* Recent bookings list items */
    #recentBookingsList > div,
    .booking-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }

    /* Local experts grid */
    #dashboardLocalExpertsGrid {
        grid-template-columns: 1fr !important;
    }

    /* Stat cards on customer side */
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    .stat-card[style*="padding: 25px"] {
        padding: 14px !important;
    }
}

/* === JOBS FOR YOU — MOBILE CARD FIX === */
@media (max-width: 768px) {

    /* Job match card */
    .match-card-luxury > div[style*="justify-content:space-between"],
    .match-card-luxury > div[style*="justify-content: space-between"] {
        flex-wrap: wrap !important;
        gap: 10px !important;
    }

    /* Job card inner row */
    .match-card-luxury .btn-group {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Bid buttons on job cards */
    .match-card-luxury a,
    .match-card-luxury button {
        flex: 1;
        min-width: 100px;
        text-align: center;
        justify-content: center;
    }
}

/* === PROFILE PAGE — MOBILE FRIENDLY === */
@media (max-width: 768px) {

    /* Profile photo + info side by side */
    .profile-hero {
        flex-direction: column !important;
        text-align: center !important;
        align-items: center !important;
    }

    /* Form groups — full width inputs */
    .form-group {
        margin-bottom: 14px;
    }

    .form-control {
        font-size: 15px !important;
        padding: 12px 14px !important;
    }

    /* KYC upload grid */
    .kyc-grid {
        grid-template-columns: 1fr !important;
    }
}

/* === VENDOR WALLET PAGE — FULL MOBILE FIX === */
@media (max-width: 900px) {

    /* Main 2-col grid → single column */
    #walletMainGrid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    /* Main wallet balance card */
    .wallet-main-card {
        padding: 28px 18px !important;
    }

    /* Balance display */
    .balance-value {
        font-size: clamp(28px, 9vw, 52px) !important;
        letter-spacing: -1px !important;
    }

    /* 3-col balance breakdown — keep 3 col but smaller */
    .wallet-main-card > div[style*="grid-template-columns:1fr 1fr 1fr"] {
        gap: 8px !important;
    }

    /* Action buttons row */
    .wallet-main-card > div[style*="grid-template-columns:1fr 1fr"] {
        gap: 10px !important;
    }

    /* Wallet action buttons height */
    .btn-wallet-add,
    .wallet-main-card .btn {
        height: 48px !important;
        font-size: 14px !important;
    }

    /* Referral section */
    .referral-card {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 14px !important;
    }

    .referral-card > div[style*="display: flex; align-items: center; gap: 12px"] {
        width: 100% !important;
    }

    .ref-code-box {
        flex: 1 !important;
        text-align: center !important;
    }

    /* Offer banner at top */
    .offer-banner {
        flex-direction: column !important;
        gap: 12px !important;
        align-items: flex-start !important;
    }

    /* Wallet topbar — hide Update Status text, keep icon */
    .hide-mobile { display: none !important; }

    /* Transaction table */
    #txnHistoryBody tr td:first-child div:first-child {
        font-size: 12px !important;
    }
}

/* === VENDOR OFFERS-PRICING — MOBILE FIX === */
@media (max-width: 900px) {

    /* Service/Incentive section-header — stack button below heading */
    .section-header[style*="justify-content: space-between"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 14px !important;
    }

    .section-header[style*="justify-content: space-between"] button {
        width: 100% !important;
        text-align: center !important;
    }

    /* INIT MODULE button — full width */
    .card-luxury button[onclick*="showAddOfferModal"],
    .card-luxury button[onclick*="showServiceModal"] {
        width: 100% !important;
        margin-top: 8px !important;
    }

    /* Offer cards */
    .offer-card-luxury > div[style*="justify-content:space-between"] {
        flex-wrap: wrap !important;
        gap: 10px !important;
    }

    /* Price-action row inside offer card */
    .offer-card-luxury div[style*="display: flex; align-items: center; gap: 16px"] {
        flex-wrap: wrap !important;
    }

    /* DIAGNOSTICS section - collapse header */
    .diagnostics-toggle {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        cursor: pointer !important;
        touch-action: manipulation !important;
    }
}

/* === NOTIFICATIONS PAGE === */
@media (max-width: 768px) {

    .notif-card {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }
}

/* === MODAL FIXES — MOBILE === */
@media (max-width: 768px) {

    .modal-content {
        padding: 24px 18px !important;
        border-radius: 20px !important;
        max-width: calc(100vw - 24px) !important;
    }

    .modal-overlay {
        padding: 12px !important;
        align-items: flex-end !important;
    }

    /* Bottom sheet style on mobile */
    .modal-overlay.active .modal-content {
        border-radius: 24px 24px 0 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
    }
}

/* === PARTNER PROGRAM PAGE === */
@media (max-width: 768px) {

    .partner-hero {
        flex-direction: column !important;
        gap: 16px !important;
    }

    .partner-plan-grid {
        grid-template-columns: 1fr !important;
    }
}

/* === MAINTENANCE PLAN PAGE === */
@media (max-width: 768px) {

    .plan-card {
        padding: 20px !important;
    }

    .plan-price {
        font-size: 28px !important;
    }
}

/* === TOPBAR NOTIF BADGE FIX === */
.topbar-notif-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
}

/* === GENERAL TABLE MOBILE === */
@media (max-width: 768px) {
    table.data-table th,
    table.data-table td {
        padding: 10px 8px !important;
        font-size: 12px !important;
    }

    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
}

/* === PREMIUM WELCOME CARD ON MOBILE === */
@media (max-width: 480px) {

    h1[style*="font-size: 28px"],
    h1[style*="font-size:28px"] {
        font-size: 20px !important;
    }

    .topbar-title {
        font-size: 15px !important;
        max-width: 110px !important;
    }

    /* Stat cards 2-col */
    .grid-4[style*="margin-bottom"] {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Very small screen font base */
    body { font-size: 14px; }

    /* Card full padding */
    .dashboard-content {
        padding: 12px 10px 80px !important;
    }
}

/* === SIDEBAR OVERLAY Z-INDEX === */
.sidebar-overlay {
    z-index: 1900 !important;
}

.sidebar {
    z-index: 2000 !important;
}

/* === SMOOTH SCROLLING ON MOBILE === */
* {
    -webkit-overflow-scrolling: touch;
}

.dashboard-content,
.dashboard-main {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* === FIX OVERFLOW ON TOPBAR === */
@media (max-width: 900px) {
    .topbar-right {
        overflow-x: auto;
        overflow-y: hidden;
        max-width: calc(100vw - 110px);
        justify-content: flex-end;
    }
    .topbar-right::-webkit-scrollbar {
        display: none;
    }

    .topbar-left {
        flex-shrink: 0;
        gap: 6px !important;
    }
}

/* === ANIMATED ENTRANCE — Mobile === */
@media (max-width: 900px) {
    .animate-slide-up,
    .animate-fade-in {
        animation-duration: 0.3s !important;
    }
}

/* === CARD HOVER — DISABLE ON TOUCH === */
@media (hover: none) {
    .card:hover,
    .service-card:hover,
    .match-card-luxury:hover {
        transform: none !important;
        box-shadow: none !important;
    }
}


/* === ADMIN DASHBOARD FIXES === */
@media (max-width: 900px) {
    /* Admin Users Page Filters */
    .filter-bar {
        flex-direction: column;
        align-items: stretch !important;
        padding: 15px !important;
        gap: 12px !important;
    }
    
    .filter-group, .search-group {
        width: 100% !important;
        flex: 1 1 auto !important;
    }
    
    /* Admin Settings Grid */
    .setting-grid {
        grid-template-columns: 1fr !important;
    }
    
    .setting-section {
        padding: 20px !important;
    }
    
    .bonus-rule-row {
        grid-template-columns: 1fr !important;
    }

    /* Admin Partners Grid */
    .partner-row {
        grid-template-columns: 1fr !important;
        text-align: center;
        gap: 12px !important;
    }
    
    .partner-row > div[style*="display:flex; gap:10px"] {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .dispatch-card {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }
    
    .dispatch-card > div:last-child {
        text-align: left !important;
    }
    
    /* Admin Categories Grid */
    .cat-grid {
        grid-template-columns: 1fr !important;
    }

    /* Admin Modals Fixes */
    .modal {
        max-width: 100% !important;
        width: calc(100% - 30px) !important;
        margin: 15px auto !important;
    }
}

/* === BID TERMINAL MOBILE FIXES === */
@media (max-width: 600px) {
    /* Stack inline 2-column grids (like option buttons and revenue structures) */
    .option-btn-group,
    div[style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* Option button padding adjust */
    .option-btn {
        padding: 20px 16px !important;
    }
    
    .option-btn-group > div[style*="padding:32px"] {
        padding: 20px !important;
    }

    /* Steps Progress Wizard - hide text on small screens */
    .steps-progress {
        margin-bottom: 24px !important;
        gap: 4px !important;
    }

    .step-item .step-label {
        font-size: 10px !important;
        text-align: center;
        margin-top: 4px;
        line-height: 1.2;
    }
    
    .step-item .step-num {
        width: 28px !important;
        height: 28px !important;
        font-size: 12px !important;
    }
    
    /* Make step connecting line shorter and adjust position */
    .step-item:not(:last-child)::after {
        top: 14px !important;
    }

    /* Adjust the step panel padding */
    .card-luxury.animate-slide-up[style*="padding:48px"] {
        padding: 24px 16px !important;
        min-height: auto !important;
    }

    /* Make large inputs fit */
    #bidAmount {
        font-size: 20px !important;
        padding: 16px !important;
    }

    /* Wizard navigation buttons stack or fit */
    #bidWizardBtns {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    #bidWizardBtns button {
        flex: 1;
        min-width: 45%;
        padding: 12px !important;
        font-size: 14px !important;
    }
    
    /* Dispatched Proposal Card adjust */
    .step-panel[id="bs6"] > div.card-luxury {
        padding: 20px !important;
        min-width: 100% !important;
    }
    
    #confirmedBid {
        font-size: 32px !important;
    }

    /* Admin Payment Verification Desk Responsive */
    .verification-grid {
        grid-template-columns: 1fr !important;
    }
    .ver-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        width: 100%;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
    }
    .ver-filter-btn {
        white-space: nowrap;
        padding: 8px 16px;
        font-size: 12px;
    }
    .ver-card {
        padding: 16px;
    }
    .ver-card-header {
        flex-wrap: wrap;
    }
    .ver-actions {
        grid-template-columns: 1fr;
    }
    .btn-approve, .btn-reject {
        width: 100%;
        height: 42px;
    }
}

