/* iOS-style Navigation */
.navbar-modern {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    padding: 0.8rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: #1d1d1f !important;
    text-decoration: none;
    transition: all 0.3s ease;
}

.navbar-brand:hover {
    color: #007AFF !important;
    transform: scale(1.02);
}

.navbar-brand i {
    background: linear-gradient(135deg, #007AFF, #5856D6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-nav .nav-link {
    color: #1d1d1f !important;
    font-weight: 500;
    padding: 0.65rem 0.7rem !important;
    border-radius: 12px;
    margin: 0 0.2rem;
    transition: all 0.3s ease;
    position: relative;
}

.navbar-nav .nav-link:hover {
    background: rgba(0, 122, 255, 0.1);
    color: #007AFF !important;
    transform: translateY(-1px);
}

.navbar-nav .nav-link.active {
    background: #007AFF;
    color: white !important;
}

/* Cart Badge */
.cart-link {
    position: relative;
    padding: 0.5rem 1rem !important;
    border-radius: 12px;
    background: rgba(0, 122, 255, 0.1);
    transition: all 0.3s ease;
}

.cart-link:hover {
    background: rgba(0, 122, 255, 0.2);
    transform: scale(1.05);
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #FF3B30;
    color: white;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* User Dropdown */
.user-dropdown {
    background: linear-gradient(135deg, #007AFF, #5856D6);
    color: white !important;
    border-radius: 25px;
    padding: 0.45rem 0.9rem !important;
    font-weight: 600;
    transition: all 0.3s ease;
}

.user-dropdown:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 122, 255, 0.3);
    color: white !important;
}

.dropdown-menu {
    border: none;
    border-radius: 16px;
    padding: 0.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    margin-top: 0.5rem;
}

.dropdown-item {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 0.2rem 0;
    transition: all 0.3s ease;
    font-weight: 500;
}

.dropdown-item:hover {
    background: rgba(0, 122, 255, 0.1);
    color: #007AFF;
    transform: translateX(5px);
}

/* Auth Buttons */
.auth-btn {
    padding: 0.5rem 1.5rem !important;
    border-radius: 25px;
    font-weight: 600;
    margin: 0 0.3rem;
    transition: all 0.3s ease;
}

.btn-signup {
    background: linear-gradient(135deg, #007AFF, #5856D6);
    color: white !important;
    border: none;
}

.btn-signup:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 122, 255, 0.3);
    color: white !important;
}

.btn-login {
    background: rgba(0, 122, 255, 0.1);
    color: #007AFF !important;
    border: 2px solid rgba(0, 122, 255, 0.2);
}

.btn-login:hover {
    background: rgba(0, 122, 255, 0.2);
    transform: translateY(-1px);
    color: #007AFF !important;
}

/* Flash Messages */
.alert-modern {
    border: none;
    border-radius: 16px;
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    backdrop-filter: blur(20px);
    font-weight: 500;
}

.alert-success {
    background: rgba(52, 199, 89, 0.1);
    color: #34C759;
    border-left: 4px solid #34C759;
}

.alert-danger {
    background: rgba(255, 59, 48, 0.1);
    color: #FF3B30;
    border-left: 4px solid #FF3B30;
}

.alert-info {
    background: rgba(0, 122, 255, 0.1);
    color: #007AFF;
    border-left: 4px solid #007AFF;
}

.alert-warning {
    background: rgba(255, 149, 0, 0.1);
    color: #FF9500;
    border-left: 4px solid #FF9500;
}

/* ===============================
   Mobile Navbar Layout Fix
================================*/
@media (max-width: 991px) {
    .navbar-modern .container {
        display: flex;
        align-items: center;
        gap: 14px;   /* controls spacing */
    }

    .navbar-brand {
        margin-left: 0;
    }

    .mobile-menu-btn {
        flex-shrink: 0;
    }

    .mobile-right-icons {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
        margin-left: auto;
    }
}

/* Mobile Sidebar */
.mobile-menu {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100%;
    background: #f9f9fb;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
    border-top-right-radius: 20px;
    border-bottom-right-radius: 20px;
    transition: all 0.35s ease-in-out;
    z-index: 1050;
    padding: 1rem 1.2rem;
    overflow-y: auto;
    font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.mobile-menu.open {
    left: 0;
}

/* Overlay behind menu */
.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 1040;
    transition: opacity 0.3s ease;
}

.menu-overlay.show {
    display: block;
    opacity: 1;
}

/* Header inside sidebar */
.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #eaeaea;
    padding-bottom: 0.8rem;
}

.mobile-logo {
    font-weight: 600;
    font-size: 1.2rem;
    color: #007aff;
    text-decoration: none;
}

.mobile-logo i {
    font-size: 1.3rem;
    margin-right: 6px;
}

.close-btn {
    background: #f1f1f1;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #333;
    transition: background 0.3s ease;
}

.close-btn:hover {
    background: #e0e0e0;
}

/* Menu List */
.mobile-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-menu-list li {
    margin-bottom: 0.8rem;
}

.mobile-menu-list a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #222;
    font-size: 1rem;
    padding: 0.7rem 0.8rem;
    border-radius: 10px;
    transition: background 0.25s ease, color 0.25s ease;
}

.mobile-menu-list a:hover {
    background: #007aff;
    color: #fff;
}

.mobile-menu-list i {
    font-size: 1.2rem;
}

.mobile-menu-list a.active {
    background: #007aff;
    color: #fff;
}

.mobile-menu::-webkit-scrollbar { width: 6px; }
.mobile-menu::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 10px; }
.mobile-menu::-webkit-scrollbar-track { background: transparent; }

/* Header Search (desktop) */
.header-search {
    display: flex;
    align-items: center;
    margin-right: 20px;
    background: #fff;
    border-radius: 30px;
    overflow: hidden;
    height: 40px;
    width: 170px;
    min-width: 170px;
    border: 1px solid #dcdcdc;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.header-search input {
    border: none;
    outline: none;
    padding: 0 15px;
    width: 100%;
    height: 100%;
    font-size: 14px;
    background: transparent;
}

.header-search button {
    border: none;
    background: #0d6efd;
    color: #fff;
    width: 50px;
    height: 100%;
    flex-shrink: 0;
    cursor: pointer;
}

.header-search input::placeholder { color: #999; }

/* Prevent navbar wrapping on desktop */
.navbar .container { flex-wrap: nowrap !important; }

@media (min-width: 992px) {
    .navbar-collapse {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
    }
    .navbar-nav { flex-wrap: nowrap; }
    .navbar-nav .nav-link { white-space: nowrap; }
}

/* ── Mobile Right Icons ── */
.mobile-right-icons {
    display: flex;
    align-items: center;
    gap: 8px;   /* consistent gap between all icons */
}

/* Base icon button style */
.mobile-menu-btn,
.mobile-search-btn,
.mobile-profile-icon,
.notif-bell-btn {
    width: 38px;
    height: 38px;
    border: none !important;
    outline: none !important;
    border-radius: 12px;
    background: linear-gradient(135deg, #4da3ff, #7b8cff);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: 0.3s;
    text-decoration: none;
    flex-shrink: 0;
}

/* Bell overrides — must match the gradient buttons */
.notif-bell-btn {
    font-size: 1rem;
    padding: 0;
}

/* Hover state for all */
.mobile-menu-btn:hover,
.mobile-search-btn:hover,
.mobile-profile-icon:hover,
.notif-bell-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Mobile Search Dropdown */
.mobile-search-box {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    background: #fff;
    padding: 12px;
    z-index: 1040;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.mobile-search-box.active { display: block; }

.mobile-search-wrapper {
    display: flex;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid #ddd;
}

.mobile-search-wrapper input {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px;
}

.mobile-search-wrapper button {
    width: 50px;
    border: none;
    background: #0d6efd;
    color: #fff;
}

/* ── Small phones (≤ 576px) ── */
@media (max-width: 576px) {
    .mobile-menu-btn,
    .mobile-search-btn,
    .mobile-profile-icon,
    .notif-bell-btn {
        width: 34px !important;
        height: 34px !important;
        font-size: 15px !important;
        border-radius: 10px;
    }

    .mobile-right-icons { gap: 7px; }

    .cart-badge,
    .notif-badge {
        font-size: 10px;
        min-width: 14px;
        height: 14px;
        padding: 1px 3px;
    }

    .navbar-brand { font-size: 1rem; }
}

/* Notification badge on bell */
.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ef4444;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
    pointer-events: none;
}

.notif-badge.hidden { display: none; }