/* ===================================
   InfoTech Zone Store - Responsive Styles
   FINAL VERSION - Cleaned & Fixed
   =================================== */

/* Global Responsive Fixes */
* {
    box-sizing: border-box;
}

html,
body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

/* Hide mobile menu toggle on desktop */
.mobile-menu-toggle {
    display: none;
}

.mobile-actions {
    display: none;
}

.desktop-only {
    display: block;
}

.navbar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
}

.navbar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Tablet and Mobile (768px and below) */
@media (max-width: 768px) {

    /* Mobile Header Layout */
    .navbar-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 1rem;
        width: 100%;
        max-width: 100vw;
    }

    /* Smaller Logo */
    .navbar-brand {
        font-size: 1.1rem;
        gap: 0.5rem;
    }

    .navbar-brand svg {
        width: 24px;
        height: 24px;
    }

    /* Mobile Actions (Cart + Toggle) */
    .mobile-actions {
        display: flex;
        align-items: center;
        gap: 1rem;
    }

    .desktop-only {
        display: none !important;
    }

    /* Cart Button Mobile */
    .cart-btn-mobile {
        background: none;
        border: none;
        padding: 0;
        cursor: pointer;
        position: relative;
        color: var(--text-primary);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .cart-badge {
        position: absolute;
        top: -6px;
        right: -6px;
        background: var(--error);
        color: white;
        font-size: 0.7rem;
        font-weight: bold;
        border-radius: 50%;
        height: 18px;
        width: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px solid var(--bg-primary);
    }

    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.25rem;
        z-index: 1001;
        background: none;
        border: none;
        cursor: pointer;
        color: var(--text-primary);
        font-size: 1.5rem;
    }

    /* Mobile navigation menu */
    .navbar-nav {
        position: fixed;
        top: 72px;
        /* Match navbar height */
        right: -100%;
        width: 100%;
        max-width: 100%;
        /* Full width */
        height: calc(100vh - 72px);
        /* Full height minus header */
        background-color: var(--bg-primary);
        flex-direction: column;
        padding: 1.5rem;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
        transition: right 0.3s ease, visibility 0.3s ease;
        z-index: 1000;
        align-items: stretch;
        border-left: 1px solid var(--border-light);
        overflow-y: auto;
        gap: 1rem;
        visibility: hidden;
        padding-bottom: 2rem;
    }

    .navbar-nav.active {
        right: 0;
        visibility: visible;
    }

    .navbar-nav li {
        width: 100%;
    }

    /* Mobile Menu Items */
    .navbar-nav li a {
        display: flex;
        align-items: center;
        padding: 0.75rem 1rem;
        border-radius: var(--radius-sm);
        background: var(--bg-tertiary);
        font-size: 1rem;
        font-weight: 500;
        color: var(--text-primary);
        text-decoration: none;
        margin-bottom: 0.5rem;
        transition: all 0.2s ease;
    }

    .navbar-nav li a:active {
        transform: scale(0.98);
    }

    .navbar-nav li a.active {
        background: var(--primary);
        color: white;
    }

    /* Fix: "Get Started" button visibility in Mobile Menu */
    .navbar-nav li a.btn-primary {
        background-color: var(--primary) !important;
        color: white !important;
        justify-content: center;
        margin-top: 0.5rem;
    }

    /* Mobile Inline Group (Profile & Theme) */
    .navbar-nav .mobile-inline-group {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 0.5rem;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--border-light);
        width: 100%;
    }

    .mobile-inline-group .profile-dropdown {
        display: block;
        width: auto;
        position: relative;
    }

    /* Fix Profile Menu Position on Mobile */
    .profile-menu {
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        /* Align to left */
        right: auto !important;
        width: 200px !important;
        transform: none !important;
        z-index: 1005 !important;
        margin-top: 0.5rem !important;
    }

    /* Typography - Reduced sizes for Mobile */
    h1,
    .hero-title {
        font-size: 1.75rem;
        /* Reduced from 2rem for better fit */
        line-height: 1.2;
    }

    /* Reduce Button Sizes on Mobile */
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    /* Homepage adjustments */
    .stats-container {
        margin-top: -2rem;
        padding: 2rem 1.5rem;
    }

    .hero-section {
        padding: 3rem 0 5rem;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    /* Dark Mode Overrides for Mobile Menu */
    html[data-theme="dark"] .navbar-nav {
        background-color: #1e293b;
        border-color: #334155;
    }

    html[data-theme="dark"] .navbar-nav li a {
        background-color: #0f172a;
        color: #f8fafc;
    }

    html[data-theme="dark"] .navbar-nav li a.active {
        background-color: var(--primary);
        color: white;
    }
}