/* Client top navbar styles. */
:root {
    --navbar-height: 70px;
    --primary-color: var(--primary);
    --primary-dark: var(--primary1);
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --dark-color: #2c3e50;
    --light-color: #f8f9fa;
    --border-color: #e3e8ef;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);
}

.modern-navbar-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    background: var(--navbar-bg, rgba(255, 255, 255, 0.98));
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-color);
}

.modern-navbar {
    height: var(--navbar-height);
}

.navbar-container {
    max-width: 100%;
    height: 100%;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* 左侧区域 */
.navbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.menu-toggle {
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    background: var(--light-color);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.3s ease;
}

.menu-toggle:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    transform: scale(1.05);
}

.menu-toggle.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.menu-toggle span {
    width: 20px;
    height: 2px;
    background: var(--dark-color);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.menu-toggle:hover span {
    background: white;
}

.menu-toggle.active span {
    background: white;
}

.navbar-brand img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

/* 中间区域 - 钱包信息 */
.navbar-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wallet-info {
    display: flex;
    align-items: center;
    gap: 30px;
}

.wallet-balance,
.wallet-discount {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--light-color);
    border-radius: 25px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.wallet-balance:hover,
.wallet-discount:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.wallet-balance i,
.wallet-discount i {
    color: var(--primary);
    font-size: 16px;
}

.wallet-balance .label,
.wallet-discount .label {
    color: #6c757d;
    font-weight: 500;
}

.wallet-balance .amount,
.wallet-discount .amount {
    color: var(--primary);
    font-weight: 700;
    font-size: 16px;
}

/* 右侧区域 */
.navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-icon-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.navbar-icon-group .navbar-item {
    margin: 0;
}

/* 移动端顶部余额 */
.navbar-mobile-balance {
    display: none;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    justify-content: center;
    padding: 5px 12px;
    margin: 0 8px;
    background: var(--light-color);
    border-radius: 20px;
    font-size: 12px;
    line-height: 1.2;
}

.navbar-mobile-balance i {
    color: var(--primary);
    font-size: 14px;
    flex-shrink: 0;
}

.navbar-mobile-balance .label {
    color: #6c757d;
    font-weight: 500;
    flex-shrink: 0;
}

.navbar-mobile-balance .amount {
    color: var(--primary);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

/* 图标按钮 */
.icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--light-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.icon-btn:hover {
    background: var(--primary);
    transform: scale(1.1);
}

.icon-btn i {
    color: var(--dark-color);
    font-size: 18px;
    transition: color 0.3s ease;
}

.icon-btn:hover i {
    color: white;
}

.navbar-favorites .fa-heart {
    color: #e74c3c;
}

.icon-btn.navbar-favorites:hover .fa-heart {
    color: #fff;
}

/* 通知徽章 */
.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger-color);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}

/* 用户按钮 */
.user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border: none;
    background: var(--light-color);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-btn:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
}

.user-name {
    font-weight: 600;
    color: var(--dark-color);
    transition: color 0.3s ease;
}

.user-btn:hover .user-name {
    color: white;
}

.user-btn i {
    color: var(--dark-color);
    font-size: 10px;
    transition: all 0.3s ease;
}

.user-btn:hover i {
    color: white;
    transform: rotate(180deg);
}

/* 登录注册按钮 */
.btn-login,
.btn-register {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-login {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-login:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-register {
    background: linear-gradient(135deg, var(--primary), var(--primary1));
    color: white;
    border: none;
}

.btn-register:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--primary1), var(--primary));
}

/* 下拉菜单 */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    padding: 0;
    border: none;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
    background: white;
    overflow: hidden;
    display: none !important;
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.dropdown-menu.show {
    display: block !important;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    animation: fadeInDown 0.3s ease;
}

/* 确保下拉菜单不超出视窗 */
.dropdown-menu-right {
    right: 0;
    left: auto;
}

/* 确保初始状态隐藏 */
.notification-dropdown .dropdown-menu,
.user-dropdown .dropdown-menu {
    display: none !important;
}

.notification-dropdown .dropdown-menu.show,
.user-dropdown .dropdown-menu.show {
    display: block !important;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 通知菜单 */
.notification-menu {
    width: 360px;
    max-width: calc(100vw - 40px);
    max-height: 480px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dropdown-header {
    padding: 15px 20px;
    background: var(--light-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dropdown-header h6 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-color);
}

.dropdown-header .badge {
    background: var(--primary);
    color: white;
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 12px;
}

.notification-list {
    flex: 1;
    overflow-y: auto;
    max-height: 350px;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 20px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s ease;
}

.notification-item:hover {
    background: var(--light-color);
}

.notification-item.unread {
    background: #f0f6ff;
}

.notification-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark-color);
    line-height: 1.4;
}

.notification-time {
    font-size: 12px;
    color: #6c757d;
}

.notification-time i {
    margin-right: 4px;
}

.dropdown-footer {
    padding: 10px;
    text-align: center;
    background: var(--light-color);
    border-top: 1px solid var(--border-color);
}

.dropdown-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

/* 用户菜单 */
.user-menu {
    width: 280px;
    max-width: calc(100vw - 40px);
}

.user-info {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(135deg, var(--primary), var(--primary1));
}

.user-info img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid white;
}

.user-info h6 {
    margin: 0 0 4px;
    color: white;
    font-size: 16px;
    font-weight: 600;
}

.user-info span {
    color: rgba(255,255,255,0.9);
    font-size: 13px;
}

.dropdown-divider {
    margin: 0;
    border-color: var(--border-color);
}

.dropdown-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--dark-color);
    text-decoration: none;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: var(--light-color);
    padding-left: 25px;
}

.dropdown-item i {
    width: 20px;
    text-align: center;
    color: var(--primary);
}

.dropdown-item.logout {
    color: var(--danger-color);
}

.dropdown-item.logout i {
    color: var(--danger-color);
}

/* 页面占位 */
.navbar-spacer {
    height: var(--navbar-height);
}

/* 响应式设计 */
@media (max-width: 991px) {
    .navbar-container {
        padding: 0 10px;
        gap: 8px;
    }

    .navbar-left {
        gap: 10px;
        flex-shrink: 0;
    }

    .navbar-right {
        gap: 8px;
        flex-shrink: 0;
    }

    .navbar-mobile-balance {
        display: flex;
    }

    .wallet-info {
        display: none;
    }

    .navbar-center {
        display: none;
    }
}

@media (max-width: 767px) {
    .user-name {
        display: none;
    }

    .btn-login span,
    .btn-register span {
        display: none;
    }

    .btn-login,
    .btn-register {
        width: 40px;
        height: 40px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
    }

    .notification-menu {
        width: 320px;
        max-width: calc(100vw - 30px);
    }

    .user-menu {
        width: 260px;
        max-width: calc(100vw - 30px);
    }

    /* 移动端下拉菜单调整 */
    .dropdown-menu {
        right: 0 !important;
        left: auto !important;
        transform-origin: top right;
    }
}

@media (max-width: 480px) {
    .navbar-brand img {
        height: 32px;
    }

    .menu-toggle {
        width: 36px;
        height: 36px;
    }

    .navbar-right {
        gap: 6px;
    }

    .navbar-icon-group {
        gap: 2px;
    }

    .navbar-mobile-balance {
        margin: 0 4px;
        padding: 4px 8px;
    }

    .navbar-mobile-balance .label {
        display: none;
    }

    .navbar-mobile-balance .amount {
        max-width: 90px;
        font-size: 13px;
    }
}

/* Inline style consolidation. */
.notification-dropdown .dropdown-menu,
.user-dropdown .dropdown-menu {
    display: none;
}
