/* ============================================================
   BallotStream · Shared User Mobile Responsiveness System
   Included in all user/*.html pages
   ============================================================ */

/* ── Mobile Header Bar ── */
.mobile-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-white);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 2001;
    box-shadow: 0 2px 12px rgba(37,99,235,0.08);
}
.mobile-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.mobile-logo img { height: 38px; width: 38px; border-radius: 10px; }
.mobile-logo span { font-weight: 800; font-size: 1.1rem; background: linear-gradient(135deg, var(--primary, #2563eb), var(--secondary, #6366f1)); background-clip: text; -webkit-background-clip: text; color: transparent; }
.hamburger {
    background: var(--primary-soft, #eff6ff); border: none; cursor: pointer;
    width: 44px; height: 44px; border-radius: 12px;
    display: none; flex-direction: column; align-items: center; justify-content: center;
    gap: 5px; transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(37,99,235,0.08);
    margin-left: auto; /* Forces to the top right */
}
.hamburger span {
    width: 22px; height: 2.5px; background: var(--primary, #2563eb);
    border-radius: 4px; transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
}
.hamburger.active span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; transform: translateX(10px); }
.hamburger.active span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

.hamburger:hover { background: #eff6ff; transform: scale(1.05); }

/* ── Sidebar Overlay ── */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.5);
    z-index: 2004;
}
.sidebar-overlay.active { display: block; }

/* ── Tablet ── */
@media (max-width: 1024px) {
    .dash-grid { grid-template-columns: 1fr !important; }
}

/* ── Mobile & Tablet Refinements ── */
@media (max-width: 992px) {
    .sidebar {
        position: fixed !important;
        left: auto !important;
        right: -300px; /* Hidden by default */
        top: 0;
        width: 280px;
        height: 100vh;
        z-index: 2005;
        background: #ffffff;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex;
        flex-direction: column;
        padding: 0 !important;
        box-shadow: -10px 0 40px rgba(15,23,42,0.15);
        overflow-y: auto;
        border: none !important;
    }
    .sidebar.open, .sidebar.active {
        right: 0 !important;
    }

    /* Sidebar Header (Inspo Style) */
    .sidebar-header {
        display: flex;
        align-items: center;
        padding: 1.5rem;
        background: #f0f7ff;
        border-bottom: 1px solid #e2e8f0;
        gap: 12px;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    .sidebar-header img { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
    .sidebar-header span { font-weight: 800; font-size: 1.1rem; color: #1e293b; flex: 1; }
    .sidebar-close { background: none; border: none; font-size: 1.2rem; color: #94a3b8; cursor: pointer; padding: 4px; }

    /* Nav Items (Inspo Style) */
    .nav-item {
        display: flex;
        align-items: center;
        padding: 1.2rem 1.5rem;
        text-decoration: none;
        color: #475569;
        font-weight: 600;
        font-size: 1rem;
        gap: 15px;
        border-bottom: 1px solid #f1f5f9;
        transition: 0.2s;
        opacity: 0;
        transform: translateX(20px);
    }
    .sidebar.open .nav-item, .sidebar.active .nav-item { opacity: 1; transform: translateX(0); }
    
    .nav-item i {
        width: 38px;
        height: 38px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        font-size: 1rem;
        transition: 0.3s;
    }

    /* Icon Colors based on Inspo */
    .nav-item:nth-child(2) i { background: #eff6ff; color: #3b82f6; } 
    .nav-item:nth-child(3) i { background: #fff7ed; color: #f97316; } 
    .nav-item:nth-child(4) i { background: #f5f3ff; color: #8b5cf6; } 
    .nav-item:nth-child(5) i { background: #ecfdf5; color: #10b981; } 
    .nav-item:nth-child(6) i { background: #fff1f2; color: #f43f5e; } 

    .nav-item:hover { background: #f8fafc; color: var(--primary); }
    .nav-item:hover i { transform: scale(1.1); }

    .sidebar.open .nav-item:nth-child(1) { transition: 0.4s 0.1s; }
    .sidebar.open .nav-item:nth-child(2) { transition: 0.4s 0.15s; }
    .sidebar.open .nav-item:nth-child(3) { transition: 0.4s 0.2s; }
    .sidebar.open .nav-item:nth-child(4) { transition: 0.4s 0.25s; }
    .sidebar.open .nav-item:nth-child(5) { transition: 0.4s 0.3s; }

    .layout { display: block !important; }
    .main, .main-content { padding: 1.25rem 1rem 80px !important; }
    .mobile-header { display: flex !important; }
    .hamburger { display: flex !important; } /* Ensure hamburger is visible */

    .navbar { display: none !important; }

    /* Shrink Dashboard Cards */
    .summary-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    .card {
        padding: 1.25rem !important;
    }
    .stat-badge {
        padding: 0.8rem 1rem !important;
        min-width: 120px !important;
    }

    /* Bottom Nav */
    .bottom-nav { display: flex !important; }
}

@media (max-width: 768px) {
    /* Fonts and padding reductions */
    h1 { font-size: 1.5rem !important; }
    .hero-card { padding: 1.5rem !important; border-radius: 20px !important; }
    .card { padding: 1.25rem !important; border-radius: 18px !important; }
    
    .header-main {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
        margin-bottom: 1.5rem !important;
    }
    .header-main > div { width: 100%; }
    .header-main div[style*="text-align: right"] { text-align: left !important; margin-top: 0.5rem; }

    .welcome-banner {
        padding: 2rem 1.5rem !important;
        text-align: left !important;
    }
    .welcome-banner h2 { font-size: 1.6rem !important; margin-bottom: 0.8rem !important; line-height: 1.2 !important; }
    .welcome-banner p { font-size: 0.9rem !important; max-width: 100% !important; }
    .welcome-banner .btn { width: 100% !important; text-align: center; justify-content: center; }

    .sidebar .logo-container { display: none !important; }

    /* Voting booth grid (vote.html) */
    body { padding: 0 !important; height: 100% !important; align-items: stretch !important; }
    .tablet-frame { border: none !important; border-radius: 0 !important; min-height: 100vh !important; height: 100% !important; margin: 0 !important; }
    .top-header { padding: 1.5rem 1.2rem !important; flex-direction: column !important; align-items: flex-start !important; gap: 1rem !important; }
    .header-titles h1 { font-size: 1.4rem !important; }
    .header-right { text-align: left !important; }
    .sub-header { padding: 0.8rem 1.2rem !important; font-size: 0.95rem !important; }
    .main-workspace { flex-direction: column !important; }
    .voting-sidebar { display: none !important; }
    .candidates-area { padding: 1rem !important; }
    .candidate-grid-tablet { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important; gap: 0.75rem !important; }
    .cand-img-wrapper { height: 120px !important; }
    .cand-footer { padding: 0.6rem !important; min-height: 80px !important; }
    .bottom-footer { padding: 1rem 1.2rem !important; flex-direction: column-reverse !important; gap: 1rem !important; }
    .btn-nav { width: 100% !important; text-align: center; }
    .modal-content { padding: 1.5rem !important; }
}
