/* ============================================================
   BlinkHustle — Complete Mobile Responsive CSS v4.0
   Covers: landing, dashboard, admin, auth, all public pages
   Breakpoints: 1024px (tablet), 768px (mobile), 480px (small)
   ============================================================ */

/* ===== MOBILE SIDEBAR OVERLAY ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 850;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: overlayFadeIn 0.25s ease;
}
.sidebar-overlay.active { display: block; }
@keyframes overlayFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ===== HAMBURGER BUTTON (Dashboard/User) ===== */
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px; height: 42px;
    background: rgba(16,185,129,0.1);
    border: 2px solid rgba(16,185,129,0.25);
    border-radius: 10px;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    padding: 0;
    transition: all 0.3s;
    flex-shrink: 0;
    outline: none;
}
.mobile-menu-btn:hover { background: rgba(16,185,129,0.2); border-color: rgba(16,185,129,0.5); }
.mobile-menu-btn .bar {
    display: block;
    width: 20px; height: 2px;
    background: #008751;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    transform-origin: center;
}
.mobile-menu-btn.open .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-menu-btn.open .bar:nth-child(2) { opacity: 0; transform: scaleX(0); }
.mobile-menu-btn.open .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== HAMBURGER BUTTON (Admin - dark theme) ===== */
.admin-mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px; height: 42px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    padding: 0;
    transition: all 0.3s;
    flex-shrink: 0;
    outline: none;
}
.admin-mobile-menu-btn:hover { background: rgba(16,185,129,0.2); border-color: rgba(16,185,129,0.4); }
.admin-mobile-menu-btn .bar {
    display: block;
    width: 20px; height: 2px;
    background: #e2e8f0;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    transform-origin: center;
}
.admin-mobile-menu-btn.open .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.admin-mobile-menu-btn.open .bar:nth-child(2) { opacity: 0; transform: scaleX(0); }
.admin-mobile-menu-btn.open .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== CLOSE BUTTON INSIDE SIDEBAR ===== */
.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 1rem; right: 1rem;
    width: 32px; height: 32px;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #ef4444;
    transition: all 0.2s;
    z-index: 10;
    outline: none;
}
.sidebar-close-btn:hover { background: rgba(239,68,68,0.2); transform: rotate(90deg); }

/* ===== SCROLL LOCK ===== */
body.sidebar-open { overflow: hidden; }

/* ===== UTILITY ===== */
@media (max-width: 768px) { .hide-mobile { display: none !important; } .show-mobile { display: block !important; } }
@media (min-width: 769px) { .show-mobile { display: none !important; } }

/* ===== TABLE OVERFLOW — ALL TABLES ===== */
.table-responsive, .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ============================================================
   MOBILE NAV DRAWER (Landing/Public pages)
   ============================================================ */
.mobile-nav-drawer {
    position: fixed;
    top: 0; right: -100%;
    width: min(320px, 85vw);
    height: 100vh;
    background: white;
    z-index: 1050;
    box-shadow: -10px 0 50px rgba(0,0,0,0.2);
    transition: right 0.35s cubic-bezier(0.4,0,0.2,1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.mobile-nav-drawer.open { right: 0; }

.mobile-nav-header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 2;
}
.mobile-nav-logo {
    font-size: 1.4rem;
    font-weight: 900;
    background: linear-gradient(135deg, #008751, #FFD700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.mobile-nav-close {
    width: 36px; height: 36px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    transition: all 0.25s;
    outline: none;
}
.mobile-nav-close:hover { background: rgba(239,68,68,0.3); transform: rotate(90deg); }

.mobile-nav-links { padding: 0.75rem 0; flex: 1; }
.mobile-nav-links a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.95rem 1.5rem;
    color: #374151;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s;
}
.mobile-nav-links a .nav-icon { font-size: 1.1rem; width: 24px; text-align: center; flex-shrink: 0; }
.mobile-nav-links a:hover { background: #F1F8E9; color: #008751; padding-left: 2rem; }
.mobile-nav-links a.nav-cta-mobile {
    margin: 1rem 1.25rem 0.5rem;
    background: linear-gradient(135deg, #008751, #006B3F);
    color: white !important;
    border-radius: 12px;
    justify-content: center;
    font-weight: 700;
    border: none;
    padding: 1rem 1.5rem;
    box-shadow: 0 6px 20px rgba(16,185,129,0.35);
}
.mobile-nav-links a.nav-cta-mobile:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(16,185,129,0.45); padding-left: 1.5rem; }
.mobile-nav-divider { margin: 0.5rem 1.5rem; border: none; border-top: 1px solid #f1f5f9; }

/* ============================================================
   LANDING PAGE — index.php
   ============================================================ */
@media (max-width: 768px) {
    nav#mainNav { padding: 0 1rem !important; height: 60px !important; }
    nav#mainNav .nav-links { display: none !important; }
    nav#mainNav .mobile-menu-btn { display: flex !important; }
    .announce-bar { top: 60px !important; padding: 0.5rem 0.75rem !important; font-size: 0.8rem !important; }
    body.has-announce { padding-top: 30px !important; }

    .hero { padding: 5rem 1.25rem 3rem !important; min-height: auto !important; }
    .hero h1 { font-size: clamp(1.8rem, 7.5vw, 2.8rem) !important; letter-spacing: -0.5px !important; line-height: 1.15 !important; }
    .hero p { font-size: 0.95rem !important; }
    .hero-badge { font-size: 0.78rem !important; padding: 0.4rem 0.9rem !important; margin-bottom: 1.25rem !important; }
    .hero-actions { flex-direction: column !important; align-items: stretch !important; gap: 0.75rem !important; }
    .btn-hero { width: 100%; justify-content: center; padding: 1rem 1.5rem !important; font-size: 0.97rem !important; }
    .live-stats { gap: 1rem !important; margin-top: 2rem !important; padding-top: 2rem !important; }
    .live-stat-value { font-size: 1.5rem !important; }

    section { padding: 3rem 1.25rem !important; }
    .container { padding: 0 !important; max-width: 100% !important; }
    .section-title { font-size: clamp(1.5rem, 6vw, 2.2rem) !important; }
    .section-sub { font-size: 0.95rem !important; }
    .section-header { margin-bottom: 2rem !important; }

    .steps-grid { grid-template-columns: 1fr !important; gap: 1rem !important; }
    .step-card { padding: 1.75rem 1.5rem !important; }
    .tasks-grid { grid-template-columns: 1fr !important; gap: 1rem !important; }
    .calc-grid { grid-template-columns: 1fr !important; gap: 1.5rem !important; }
    .gami-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 1rem !important; }
    .testi-grid { grid-template-columns: 1fr !important; gap: 1rem !important; }
    .about-grid { grid-template-columns: 1fr !important; gap: 2rem !important; }
    .about-stats { grid-template-columns: repeat(2,1fr) !important; gap: 0.75rem !important; }

    .cta-title { font-size: clamp(1.6rem, 6vw, 2.5rem) !important; }
    .btn-white { width: 100%; justify-content: center; padding: 1rem 1.5rem !important; }

    .footer-grid { grid-template-columns: 1fr !important; gap: 1.5rem !important; }
    .footer-bottom { flex-direction: column; text-align: center; gap: 0.5rem; }
}

@media (max-width: 480px) {
    .gami-grid { grid-template-columns: 1fr !important; }
    .live-stats { flex-direction: column; align-items: center; gap: 1rem !important; }
}

/* ============================================================
   AUTH PAGES
   ============================================================ */
@media (max-width: 768px) {
    .auth-container { padding: 1.25rem !important; align-items: flex-start !important; padding-top: 1.5rem !important; }
    .auth-box { padding: 1.75rem 1.25rem !important; border-radius: 16px !important; width: 100% !important; max-width: 100% !important; }
}

/* ============================================================
   DASHBOARD SIDEBAR
   ============================================================ */
@media (max-width: 1024px) {
    .mobile-menu-btn { display: flex !important; }
    .dashboard-sidebar {
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
        position: fixed !important;
        top: 70px !important; left: 0 !important;
        z-index: 900 !important;
        height: calc(100vh - 70px) !important;
        box-shadow: none;
        width: 260px !important;
    }
    .dashboard-sidebar.mobile-open { transform: translateX(0); box-shadow: 8px 0 50px rgba(0,0,0,0.18); }
    .dashboard-sidebar .sidebar-close-btn { display: flex; }
    .dashboard-main { margin-left: 0 !important; padding: 1.5rem !important; width: 100% !important; }
    .dashboard-container { padding-top: 70px !important; }
    .dashboard-header-nav .header-left { gap: 0.75rem !important; }
}

@media (max-width: 768px) {
    .dashboard-header-nav { padding: 0 1rem !important; }
    .logo { font-size: 1.2rem !important; }
    .welcome-section { padding: 1.5rem !important; border-radius: 16px !important; margin-bottom: 1.25rem !important; }
    .welcome-text h1 { font-size: 1.3rem !important; }
    .welcome-text p { font-size: 0.88rem !important; }
    .welcome-content { flex-direction: column !important; align-items: flex-start !important; gap: 0.75rem !important; }
    .level-badge { font-size: 0.9rem !important; padding: 0.65rem 1.25rem !important; }
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 0.75rem !important; }
    .stat-card { padding: 1rem !important; }
    .stat-value { font-size: 1.6rem !important; }
    .quick-actions { grid-template-columns: repeat(2, 1fr) !important; gap: 0.75rem !important; }
    .action-btn { padding: 1rem !important; }
    .action-btn-icon { font-size: 1.8rem !important; }
    .cards-grid { grid-template-columns: 1fr !important; gap: 1rem !important; }
    .card-header, .card-body { padding: 1rem 1.25rem !important; }
    .data-table { font-size: 0.82rem; }
    .data-table th, .data-table td { padding: 0.65rem 0.85rem; }
    .notifications-panel { width: 290px !important; right: -40px !important; }
    .dashboard-main { padding: 1rem !important; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr !important; }
    .quick-actions { grid-template-columns: repeat(2, 1fr) !important; }
    .notifications-panel { width: 280px !important; right: -50px !important; }
    .dashboard-main { padding: 0.75rem !important; }
    .welcome-text h1 { font-size: 1.1rem !important; }
    .stat-value { font-size: 1.4rem !important; }
    .btn-primary, .btn-secondary { padding: 0.6rem 1rem !important; font-size: 0.82rem !important; }
}

/* ============================================================
   TASKS / TASK DETAIL
   ============================================================ */
@media (max-width: 768px) {
    .tasks-grid { grid-template-columns: 1fr !important; gap: 1rem !important; }
    .stats-strip { grid-template-columns: repeat(2,1fr) !important; gap: 0.6rem !important; }
    .filter-bar { flex-direction: column !important; align-items: stretch !important; gap: 0.6rem !important; }
    .filter-bar input, .filter-bar select { width: 100% !important; }
    .activation-notice { flex-direction: column !important; gap: 0.75rem !important; }
    .pagination a, .pagination span { padding: 0.4rem 0.7rem !important; font-size: 0.82rem !important; }
}
@media (max-width: 1100px) { .detail-layout { grid-template-columns: 1fr !important; } }
@media (max-width: 768px) {
    .task-hero-grid { grid-template-columns: 1fr !important; gap: 1rem !important; }
    .task-hero { padding: 1.5rem !important; border-radius: 16px !important; }
}

/* ============================================================
   WITHDRAW / EARNINGS / REFERRALS / PROFILE / ACHIEVEMENTS
   ============================================================ */
@media (max-width: 960px) { .wd-layout { grid-template-columns: 1fr !important; } }
@media (max-width: 768px) {
    .mini-grid { grid-template-columns: 1fr 1fr !important; }
    .how-grid { grid-template-columns: repeat(2,1fr) !important; }
    .form-grid { grid-template-columns: 1fr !important; }
    .stats-mini { grid-template-columns: repeat(2,1fr) !important; }
    .top-grid { grid-template-columns: 1fr !important; }
    .ach-grid { grid-template-columns: repeat(2,1fr) !important; gap: 0.75rem !important; }
    .ach-summary-grid { grid-template-columns: 1fr 1fr !important; }
    .support-grid { grid-template-columns: 1fr !important; }
    .quick-help-grid { grid-template-columns: repeat(2,1fr) !important; }
    .filter-tabs { flex-wrap: wrap !important; gap: 0.4rem !important; }
    .filter-tabs a, .filter-tabs button { font-size: 0.8rem !important; padding: 0.4rem 0.8rem !important; }
    .notif-filter-bar { flex-wrap: wrap !important; gap: 0.5rem !important; }
    .notif-filter-bar button { flex: 1; min-width: 80px; font-size: 0.8rem !important; }
}
@media (max-width: 480px) {
    .mini-grid { grid-template-columns: 1fr !important; }
    .how-grid { grid-template-columns: 1fr !important; }
    .ach-grid { grid-template-columns: 1fr !important; }
    .quick-help-grid { grid-template-columns: 1fr !important; }
    .stats-strip { grid-template-columns: 1fr 1fr !important; }
}

/* ============================================================
   BUSINESS PAGES
   ============================================================ */
@media (max-width: 1100px) { .pay-layout { grid-template-columns: 1fr !important; } .create-layout { grid-template-columns: 1fr !important; } }
@media (max-width: 768px) {
    .kpi-grid { grid-template-columns: repeat(2,1fr) !important; }
    .analytics-grid, .analytics-grid.wide { grid-template-columns: 1fr !important; }
    .quick-amounts { grid-template-columns: repeat(2,1fr) !important; }
    .qa-grid { grid-template-columns: repeat(2,1fr) !important; }
    .business-tasks-header { flex-direction: column !important; align-items: stretch !important; gap: 0.75rem !important; }
}
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr !important; } }

/* ============================================================
   ADMIN PANEL
   ============================================================ */
@media (max-width: 1024px) {
    .admin-mobile-menu-btn { display: flex !important; }
    .admin-stats-mini { display: none !important; }
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
        position: fixed !important;
        z-index: 900 !important;
        width: 250px !important;
        height: calc(100vh - 70px) !important;
        top: 70px !important;
    }
    .admin-sidebar.mobile-open { transform: translateX(0); box-shadow: 10px 0 50px rgba(0,0,0,0.5); }
    .admin-sidebar .sidebar-close-btn { display: flex; background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.3); color: #f87171; }
    .admin-main { margin-left: 0 !important; padding: 1.5rem !important; width: 100% !important; max-width: 100vw !important; }
    .admin-header-nav { padding: 0 1rem !important; }
    .admin-header-nav .header-left { gap: 0.75rem !important; }
}

@media (max-width: 768px) {
    .stats-grid-4, .stats-grid-3 { grid-template-columns: repeat(2,1fr) !important; gap: 0.75rem !important; }
    .admin-header { flex-direction: column !important; align-items: flex-start !important; gap: 0.75rem !important; }
    .admin-header-actions { width: 100% !important; flex-wrap: wrap !important; gap: 0.5rem !important; }
    .quick-link-grid { grid-template-columns: repeat(2,1fr) !important; }
    .cards-grid, .two-col { grid-template-columns: 1fr !important; }
    .commissions-grid { grid-template-columns: 1fr !important; }
    .admin-main { padding: 1rem !important; }
    .data-table th, .data-table td { padding: 0.6rem 0.75rem; font-size: 0.8rem; }
}

@media (max-width: 480px) {
    .stats-grid-4, .stats-grid-3 { grid-template-columns: repeat(2,1fr) !important; }
    .admin-main { padding: 0.75rem !important; }
    .card-body { padding: 0.85rem !important; }
}

/* ============================================================
   FORMS — prevent iOS zoom
   ============================================================ */
@media (max-width: 768px) {
    input[type="text"], input[type="email"], input[type="password"],
    input[type="number"], input[type="tel"], input[type="search"],
    input[type="url"], select, textarea { font-size: 16px !important; }
}

/* ============================================================
   GLOBAL MOBILE POLISH
   ============================================================ */
@media (max-width: 768px) {
    .sidebar-link { padding: 0.95rem 1.5rem !important; }
    .btn-primary, .btn-secondary { min-height: 44px; }
    a, button { -webkit-tap-highlight-color: rgba(16,185,129,0.15); }
    img { max-width: 100%; height: auto; }
    iframe { max-width: 100%; }
    .card { border-radius: 14px !important; }
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .dashboard-sidebar, .mobile-nav-drawer, .admin-sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }
}
