/* ==========================================
   MOBILE STYLES v3.0 - Clean Rewrite
   ========================================== */

/* ===================
   MOBILE HEADER
   =================== */
@media (max-width: 768px) {
    /* Hide desktop elements completely - prevent old menu from showing */
    .main-nav,
    .header-right {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        position: absolute !important;
        left: -9999px !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
    }
    
    /* Prevent header-right from being activated */
    .header-right.active {
        display: none !important;
        right: -9999px !important;
    }
    
    /* Header base */
    .site-header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 60px !important;
        padding: 0 !important;
        background: #0a0a0f !important;
        border-bottom: 1px solid rgba(139, 92, 246, 0.15) !important;
        z-index: 9998 !important;
    }
    
    .header-container {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        height: 60px !important;
        padding: 0 12px !important;
        max-width: 100% !important;
    }
    
    /* Logo */
    .logo-link {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        text-decoration: none !important;
        flex: 0 0 auto !important;
        flex-shrink: 0 !important;
        margin: 0 !important;
    }
    
    .logo-link img {
        width: 38px !important;
        height: 38px !important;
        border-radius: 8px !important;
        object-fit: cover !important;
    }
    
    .logo-text {
        font-family: 'Orbitron', sans-serif !important;
        font-size: 1.2rem !important;
        font-weight: 500 !important;
        color: #a78bfa !important;
        white-space: nowrap !important;
        overflow: visible !important;
        text-overflow: unset !important;
        max-width: none !important;
    }

    /* Mobile right container */
    .header-right-mobile {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        position: absolute !important;
        right: 12px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
    
    /* Auth buttons
       Ölçülər dəyişməyib (padding 7px 12px, font-size 12px) — yalnız ikon
       əlavə olunub. Mobil header-də yer az olduğu üçün ikon və boşluq
       masaüstündən kiçikdir. */
    .m-auth-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        padding: 7px 12px !important;
        border-radius: 8px !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        text-decoration: none !important;
        white-space: nowrap !important;
    }

    .m-auth-btn i {
        font-size: 10.5px !important;
        opacity: .9 !important;
    }

    /* Yalnız ikon variantı (profil) — boşluq lazım deyil */
    .m-auth-btn.m-icon { gap: 0 !important; }
    .m-auth-btn.m-icon i { font-size: 13px !important; }

    .m-login {
        background: rgba(139, 92, 246, 0.15) !important;
        border: 1px solid rgba(139, 92, 246, 0.3) !important;
        color: #a78bfa !important;
    }

    .m-register {
        background: linear-gradient(135deg, #8b5cf6, #6d28d9) !important;
        border: none !important;
        color: #fff !important;
        /* Kiçik dərinlik — gradient düymə fonda itməsin */
        box-shadow: 0 4px 14px -4px rgba(139, 92, 246, .8) !important;
    }

    /* Hamburger button */
    .mobile-menu-toggle {
        width: 38px !important;
        height: 38px !important;
        background: transparent !important;
        border: none !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 5px !important;
        cursor: pointer !important;
        padding: 0 !important;
    }
    
    .hamburger-line {
        width: 22px !important;
        height: 2px !important;
        background: #a78bfa !important;
        border-radius: 2px !important;
    }
    
    /* Page spacing */
    .search-above-slider {
        margin-top: 70px !important;
    }
}

/* ===================
   DESKTOP: HIDE MOBILE ELEMENTS
   =================== */
@media (min-width: 769px) {
    .mobile-menu-toggle,
    .mobile-overlay,
    .mobile-side-menu,
    .mobile-bottom-nav,
    .mobile-search-overlay,
    .header-right-mobile {
        display: none !important;
    }
    
    /* Desktop header-right adjustments */
    .header-right {
        display: flex !important;
        align-items: center !important;
        gap: 15px !important;
    }
    
    .working-hours {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        font-size: 13px !important;
        color: #9ca3af !important;
        padding-right: 15px !important;
        border-right: 1px solid rgba(139, 92, 246, 0.2) !important;
    }
    
    .working-hours i {
        color: #8b5cf6 !important;
    }
    
    .contact-btn {
        padding: 9px 18px !important;
        border-radius: 10px !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        text-decoration: none !important;
        transition: all 0.2s ease !important;
    }
    
    .contact-btn.outline {
        background: transparent !important;
        border: 1px solid rgba(139, 92, 246, 0.4) !important;
        color: #a78bfa !important;
        box-shadow: none !important;
    }
    
    .contact-btn.outline:hover {
        background: rgba(139, 92, 246, 0.1) !important;
        border-color: rgba(139, 92, 246, 0.6) !important;
    }
    
    .contact-btn:not(.outline) {
        background: linear-gradient(135deg, #8b5cf6, #6d28d9) !important;
        border: none !important;
        color: #fff !important;
        box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3) !important;
    }
    
    .contact-btn:not(.outline):hover {
        box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4) !important;
        transform: translateY(-2px) !important;
    }
}

/* ===================
   MOBILE SIDE MENU
   =================== */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-overlay.open {
    display: block;
    opacity: 1;
}

.mobile-side-menu {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    max-width: 85vw;
    height: 100%;
    background: linear-gradient(180deg, #0f0f18 0%, #0a0a0f 100%);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    border-left: 1px solid rgba(139, 92, 246, 0.2);
}

.mobile-side-menu.open {
    right: 0;
}

/* Side menu header */
.side-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
}

.side-menu-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.side-menu-close {
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 8px;
    color: #9ca3af;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.side-menu-close:active {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* User section */
.side-menu-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(139, 92, 246, 0.08);
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
}

/* Profilim və Çıxış düymələri - user section-dan sonra */
.side-menu-actions {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
}

.side-menu-actions .side-btn {
    flex: 1;
    padding: 10px 12px;
    font-size: 12px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.user-label {
    font-size: 11px;
    color: #9ca3af;
}

/* Navigation links */
.side-menu-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.side-menu-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    color: #b4b4be;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.side-menu-nav a i {
    width: 20px;
    text-align: center;
    font-size: 14px;
    color: #6b7280;
}

.side-menu-nav a:active,
.side-menu-nav a.active {
    background: rgba(139, 92, 246, 0.12);
    color: #fff;
    border-left-color: #8b5cf6;
}

.side-menu-nav a.active i,
.side-menu-nav a:active i {
    color: #a78bfa;
}

/* Side menu info section (saat və whatsapp) */
.side-menu-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(139, 92, 246, 0.1);
}

.side-menu-info .side-menu-hours {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: rgba(139, 92, 246, 0.08);
    border-radius: 10px;
    font-size: 13px;
    color: #9ca3af;
    margin: 0 16px;
}

.side-menu-info .side-menu-hours i {
    color: #a78bfa;
}

.side-menu-whatsapp {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    margin: 0 16px;
    background: linear-gradient(135deg, #25D366, #128C7E);
    border-radius: 10px;
    color: #fff !important;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.side-menu-whatsapp i {
    color: #fff !important;
    font-size: 18px;
}

/* Footer - only shows when logged in */
.side-menu-footer {
    padding: 16px;
    border-top: 1px solid rgba(139, 92, 246, 0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.side-menu-footer:empty {
    display: none;
}

.side-menu-hours {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: rgba(139, 92, 246, 0.08);
    border-radius: 8px;
    font-size: 12px;
    color: #9ca3af;
}

.side-menu-hours i {
    color: #a78bfa;
}

.side-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 10px;
    color: #a78bfa;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.side-btn.primary {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    border: none;
    color: #fff;
}

.side-btn.logout {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.side-btn.whatsapp {
    background: linear-gradient(135deg, #25D366, #128C7E);
    border: none;
    color: #fff;
}

/* ===================
   BOTTOM NAVIGATION
   =================== */
@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 60px !important;
        background: rgba(10, 10, 15, 0.98) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border-top: 1px solid rgba(139, 92, 246, 0.15) !important;
        z-index: 9999 !important;
        padding: 0 8px !important;
        padding-bottom: env(safe-area-inset-bottom, 0) !important;
    }
    
    .bottom-nav-item {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-decoration: none !important;
        color: #6b7280 !important;
        font-size: 10px !important;
        font-weight: 500 !important;
        gap: 3px !important;
        position: relative !important;
    }
    
    .bottom-nav-item i {
        font-size: 18px !important;
    }
    
    .bottom-nav-item:active,
    .bottom-nav-item.active {
        color: #a78bfa !important;
    }
    
    .bottom-nav-item.active::before {
        content: '' !important;
        position: absolute !important;
        top: 0 !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 30px !important;
        height: 3px !important;
        background: linear-gradient(90deg, #8b5cf6, #ec4899) !important;
        border-radius: 0 0 3px 3px !important;
    }
    
    .bottom-nav-center-icon {
        width: 46px !important;
        height: 46px !important;
        background: linear-gradient(135deg, #8b5cf6, #6d28d9) !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin-top: -18px !important;
        box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4) !important;
        border: 3px solid #0a0a0f !important;
    }
    
    .bottom-nav-center-icon i {
        color: #fff !important;
        font-size: 18px !important;
    }
    
    .bottom-nav-balance span {
        margin-top: 2px !important;
    }
    
    /* WhatsApp hover */
    .bottom-nav-item:nth-child(4):active {
        color: #25D366 !important;
    }
}

/* ===================
   SEARCH OVERLAY
   =================== */
.mobile-search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.98);
    z-index: 10000;
}

.mobile-search-overlay.active {
    display: flex;
    flex-direction: column;
}

.mobile-search-container {
    width: 100%;
    height: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.mobile-search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.mobile-search-header h3 {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.mobile-search-close {
    width: 38px;
    height: 38px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-search-input-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.mobile-search-input-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    font-size: 16px;
}

.mobile-search-input-wrapper input {
    width: 100%;
    padding: 14px 14px 14px 44px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    color: #fff;
    /* 16px MƏCBURİDİR: iOS Safari daha kiçik font-size-lı input-a fokus
       düşəndə səhifəni avtomatik böyüdür. Əvvəl 15px idi — 1px çatmırdı. */
    font-size: 16px;
    line-height: 1.2;
    outline: none;
}

.mobile-search-input-wrapper input:focus {
    border-color: rgba(139, 92, 246, 0.5);
}

.mobile-search-input-wrapper input::placeholder {
    color: #6b7280;
}

.mobile-search-results {
    flex: 1;
    overflow-y: auto;
}

.mobile-search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin-bottom: 8px;
    text-decoration: none;
}

.mobile-search-result-item img {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    object-fit: cover;
}

.mobile-search-result-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mobile-search-result-name {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
}

.mobile-search-result-price {
    color: #a78bfa;
    font-size: 13px;
    font-weight: 600;
}

.mobile-search-result-type {
    color: #6b7280;
    font-size: 10px;
}

/* ===================
   PAGE ADJUSTMENTS
   =================== */
@media (max-width: 768px) {
    body {
        padding-bottom: 70px !important;
    }
    
    .whatsapp-button {
        bottom: 80px !important;
    }
    
    .search-above-slider {
        margin-top: 64px !important;
    }
    
    .site-footer {
        padding-bottom: 85px !important;
    }
}

/* ===================
   SMALL SCREENS
   =================== */
@media (max-width: 420px) {
    .logo-text {
        font-size: 1rem !important;
    }
    
    .m-auth-btn {
        padding: 6px 10px !important;
        font-size: 11px !important;
    }
    
    .header-right-mobile {
        gap: 6px !important;
        right: 10px !important;
    }
}

@media (max-width: 380px) {
    .logo-text {
        font-size: 0.9rem !important;
    }
    
    .m-auth-btn {
        padding: 5px 8px !important;
        font-size: 10px !important;
    }
    
    .header-right-mobile {
        gap: 5px !important;
        right: 8px !important;
    }
    
    .mobile-menu-toggle {
        width: 34px !important;
        height: 34px !important;
    }
    
    .hamburger-line {
        width: 18px !important;
    }
}

@media (max-width: 360px) {
    .logo-text {
        font-size: 0.85rem !important;
    }
    
    .logo-link img {
        width: 34px !important;
        height: 34px !important;
    }
    
    .m-auth-btn {
        padding: 5px 7px !important;
        font-size: 10px !important;
    }
    
    .header-right-mobile {
        gap: 4px !important;
        right: 8px !important;
    }
    
    .mobile-side-menu {
        width: 260px;
    }
    
    .bottom-nav-item {
        font-size: 9px !important;
    }
    
    .bottom-nav-item i {
        font-size: 16px !important;
    }
    
    .bottom-nav-center-icon {
        width: 42px !important;
        height: 42px !important;
        margin-top: -16px !important;
    }
    
    .mobile-menu-toggle {
        width: 32px !important;
        height: 32px !important;
    }
}

@media (max-width: 340px) {
    .logo-text {
        display: none !important;
    }
    
    .m-auth-btn {
        padding: 6px 10px !important;
        font-size: 11px !important;
    }
}

/* ===================
   EXTRA SMALL SCREENS (320px and below)
   =================== */
@media (max-width: 320px) {
    .logo-link img {
        width: 32px !important;
        height: 32px !important;
    }
    
    .site-header {
        height: 54px !important;
    }
    
    .header-container {
        height: 54px !important;
        padding: 0 8px !important;
    }
}
