/*
Mobile Styles for SCDev Theme Sheer
Responsive header with social icons, menu dropdown, logo, and user button
*/

@media (max-width: 768px) {
    /* Force responsive layout */
    html, body {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
    
    /* Make page full width on mobile */
    #page {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
    }
    
    /* Top header with social icons - scrollable */
    .top-header {
        display: flex !important;
        justify-content: center;
        position: static;
        width: 100% !important;
        padding: 10px 15px !important;
        box-sizing: border-box;
        height: auto !important;
        min-height: 50px;
    }
    
    /* Hide the left side (title/logo) */
    .top-header-left {
        display: none;
    }
    
    /* Center the social icons and make them responsive */
    .top-header-right {
        position: static;
        left: auto;
        transform: none;
        margin: 0 auto;
        display: flex;
        justify-content: center;
        flex-wrap: nowrap;
        gap: 8px;
        width: auto;
        max-width: 90%;
    }
    
    /* Make social icons touch-friendly on mobile */
    .top-header .social-icons a {
        font-size: 16px !important;
        padding: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 36px;
        min-height: 36px;
        border-radius: 50%;
        transition: background 0.3s;
    }
    
    .top-header .social-icons a:hover {
        background: rgba(255,255,255,0.2);
    }
    
    /* Hide user button in top header on mobile only */
    .top-header .hn-user-menu-header {
        display: none !important;
    }
    
    /* Mobile Navigation Bar - Fixed at top */
    .horizontal-nav {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 0 15px !important;
        box-sizing: border-box;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        background: #fff;
        z-index: 9990 !important;
        height: 60px !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }

    /* Push page content down so it doesn't hide under the fixed bar */
    #page {
        padding-top: 60px !important;
    }
    
    /* Mobile menu button — shows hamburger to open dropdown */
    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: none;
        border: 2px solid #3498db;
        font-size: 20px;
        color: #3498db;
        cursor: pointer;
        padding: 6px 12px;
        border-radius: 25px;
        transition: all 0.3s;
        width: auto;
        height: auto;
        order: 1;
        flex-shrink: 0;
        font-weight: 600;
        white-space: nowrap;
    }

    .mobile-menu-btn:hover {
        background: #3498db;
        color: #fff;
    }

    .mobile-menu-btn::before {
        content: "☰";
        font-size: 18px;
    }

    /* Mobile dropdown — hidden by default, shown when active */
    .mobile-menu-dropdown {
        display: none !important;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
        z-index: 999;
        max-height: 92vh;
        overflow-y: auto;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.3s ease;
    }

    .mobile-menu-dropdown.active {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        height: auto !important;
        overflow-y: auto !important;
    }
    .horizontal-nav .mobile-logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        align-items: center;
        justify-content: center;
        order: 2;
        max-width: 50%;
        z-index: 1;
    }
    
    .horizontal-nav .mobile-logo a {
        display: flex;
        align-items: center;
        text-decoration: none;
    }
    
    .horizontal-nav .mobile-logo .header-custom-logo {
        height: 40px !important;
        width: auto !important;
        max-width: 120px !important;
        object-fit: contain;
        border-radius: 4px !important;
    }
    
    .horizontal-nav .mobile-logo .header-site-title {
        font-size: 18px !important;
        font-weight: 600;
        color: #333;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* User Menu - Right */
    .horizontal-nav .hn-user-menu {
        position: relative;
        display: flex !important;
        align-items: center;
        flex-shrink: 0;
        order: 3;
        /* no z-index here — avoids stacking context that caps dropdown */
    }
    
    .horizontal-nav .hn-dropdown {
        z-index: 9999 !important;
    }
    
    .horizontal-nav .hn-user-btn {
        display: flex;
        align-items: center;
        gap: 6px;
        background: none;
        border: 2px solid #3498db;
        cursor: pointer;
        padding: 6px 10px;
        border-radius: 25px;
        font-size: 14px;
        color: #3498db;
        font-family: inherit;
        transition: all 0.3s;
        font-weight: 600;
        white-space: nowrap;
    }
    
    .horizontal-nav .hn-user-btn:hover {
        background: #3498db;
        color: #fff;
    }
    
    .horizontal-nav .hn-avatar {
        width: 28px;
        height: 28px;
        border-radius: 50%;
        object-fit: cover;
        display: block;
        border: 2px solid rgba(52, 152, 219, 0.3);
        flex-shrink: 0;
    }
    
    .horizontal-nav .hn-login-btn {
        padding: 8px 16px;
        border-radius: 25px;
        background: #3498db;
        color: #fff !important;
        text-decoration: none;
        font-size: 14px;
        font-weight: 600;
        transition: background 0.3s;
        border: 2px solid #3498db;
        white-space: nowrap;
        display: flex;
        align-items: center;
        gap: 5px;
    }
    
    .horizontal-nav .hn-login-btn:hover {
        background: #2980b9;
        border-color: #2980b9;
    }
    
    /* Logo/Site Title - Center */
    .mobile-sidebar-content {
        padding: 8px 10px;
        border-top: 1px solid #f0f0f0;
        overflow-y: auto;
        max-height: 88vh;
        line-height: 1.0;
    }

    /* Zero out the inline gap on the sidebar root wrapper */
    .mobile-sidebar-content > div[id^="scvsb_"] {
        gap: 0 !important;
    }

    /* Tighten up the sidebar shortcode inside mobile dropdown */
    .mobile-sidebar-content > div {
        gap: 0 !important;
    }

    .mobile-sidebar-content .sb-section {
        margin-bottom: 2px !important;
        padding-bottom: 0 !important;
    }

    .mobile-sidebar-content .sb-row-label {
        margin-bottom: 1px !important;
        font-size: 9px !important;
    }

    .mobile-sidebar-content .sb-track {
        gap: 6px !important;
        padding: 1px 0 2px !important;
    }

    .mobile-sidebar-content .sb-ov-track {
        gap: 0 !important;
        padding: 1px 0 2px !important;
    }

    .mobile-sidebar-content .sb-card {
        gap: 2px !important;
    }

    .mobile-sidebar-content .sb-name {
        font-size: 10px !important;
    }

    .mobile-sidebar-content .sb-card img {
        width: 44px !important;
        height: 44px !important;
    }

    .mobile-sidebar-content .sb-avatar-wrap {
        width: 44px !important;
    }

    /* Overlay cards (galleries & products) in mobile dropdown */
    .mobile-sidebar-content .sb-row {
        padding: 0 22px !important;
    }

    .mobile-sidebar-content .sb-ov-track {
        width: 140px !important;
        margin: 0 auto !important;
        gap: 0 !important;
    }

    .mobile-sidebar-content .sb-ov-card {
        flex: 0 0 140px !important;
        height: 84px !important;
    }

    .mobile-sidebar-content .sb-ov-card img {
        width: 140px !important;
        height: 84px !important;
    }

    .mobile-sidebar-content .sb-ov-placeholder {
        width: 140px !important;
        height: 84px !important;
    }

    .mobile-sidebar-content .sb-ov-price {
        display: none !important;
    }

    /* Night mode for mobile dropdown */
    body.night-mode .mobile-menu-dropdown {
        background: #2a2a2a !important;
        color: #e0e0e0 !important;
    }

    body.night-mode .mobile-sidebar-content {
        border-top-color: #3a3a3a !important;
    }

    body.night-mode .mobile-menu-dropdown #mobile-primary-menu li a {
        color: #e0e0e0 !important;
        border-color: rgba(255,255,255,0.2) !important;
    }

    body.night-mode .mobile-menu-dropdown #mobile-primary-menu li a:hover {
        background: #3498db !important;
        color: #fff !important;
    }

    /* 4px top margin on Dashboard (first item in mobile dropdown nav) */
    /* Container div wp_nav_menu wraps around the ul */
    .mobile-menu-dropdown .menu {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        width: 100% !important;
        gap: 6px !important;
        padding: 10px 12px !important;
        margin: 8px 0 !important;
        list-style: none !important;
    }

    .mobile-menu-dropdown #mobile-primary-menu {
        display: flex !important;
        flex-wrap: wrap;
        gap: 6px;
        padding: 10px 12px !important;
        margin: 8px 0 8px 0 !important;
        list-style: none !important;
        justify-content: center !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Hide sub-menus in mobile dropdown — modal handles them */
    .mobile-menu-dropdown .sub-menu {
        display: none !important;
    }

    /* Hide the dropdown arrow on parent items in mobile dropdown */
    .mobile-menu-dropdown .menu-item-has-children > a::after {
        display: none !important;
    }

    .mobile-menu-dropdown #mobile-primary-menu li {
        border-bottom: none !important;
        flex-shrink: 0;
        display: flex;
        justify-content: center;
    }

    .mobile-menu-dropdown #mobile-primary-menu li a {
        display: inline-flex !important;
        align-items: center;
        padding: 5px 13px !important;
        font-size: 13px !important;
        font-weight: 600;
        border-radius: 20px;
        border: 1px solid rgba(52,152,219,0.5);
        color: #3498db !important;
        background: transparent;
        text-decoration: none;
        white-space: nowrap;
        transition: background 0.2s, color 0.2s;
    }

    .mobile-menu-dropdown #mobile-primary-menu li a:hover {
        background: #3498db !important;
        color: #fff !important;
    }
    
    /* Hide desktop navigation on mobile */
    .horizontal-nav .desktop-nav {
        display: none !important;
    }
    
    /* Hide desktop main navigation on mobile */
    .horizontal-nav .main-navigation {
        display: none !important;
    }
    
    /* Show sidebar as compact fixed-width column — same as desktop */
    .sidebar {
        display: none !important;
    }
    
    /* Make content fill remaining space */
    .main-wrapper {
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .content-wrapper {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }
    
    /* Add mobile padding to content */
    .site-content {
        padding: 20px 15px;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }
    
    /* Mobile-friendly footer */
    .site-footer {
        padding: 20px 15px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .footer-left,
    .footer-right {
        position: static;
        transform: none;
        order: unset;
    }
    
    .footer-right ul {
        justify-content: center;
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .night-mode-toggle {
        position: static;
        transform: none;
        margin: 10px auto 0;
    }
}

/* Smaller mobile devices */
@media (max-width: 480px) {
    .top-header {
        padding: 8px 10px !important;
    }
    
    .top-header-right {
        gap: 6px;
        max-width: 85%;
    }
    
    .top-header .social-icons a {
        min-width: 32px;
        min-height: 32px;
        font-size: 14px !important;
        padding: 4px;
    }
    
    .horizontal-nav {
        padding: 0 10px !important;
        height: 55px !important;
    }
    
    .horizontal-nav .site-title {
        font-size: 16px;
    }
    
    .horizontal-nav .custom-logo {
        max-width: 80px;
        max-height: 35px;
    }
    
    .hn-user-btn {
        padding: 5px 8px;
        font-size: 13px;
        gap: 4px;
    }
    
    .hn-avatar {
        width: 24px;
        height: 24px;
    }
    
    .site-content {
        padding: 15px 10px;
    }
}
