/**
 * 头部按钮样式 - 购物车和用户按钮统一设计
 * 长方形按钮，包含图标、文本和状态信息
 */

/* 用户工具区域布局 */
.user_tool {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 1rem !important;
    padding: 0 1rem !important;
}

/* 隐藏原有的图标样式 */
.user_tool .icon-wrapper {
    display: none !important;
}

/* 头部按钮基础样式 */
.header-btn {
    position: relative;
    background: #ffffff;
    border: 0px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.header-btn:hover {
    /* border-color: #72738E; */
    box-shadow: 0 4px 12px rgba(114, 115, 142, 0.15);
    transform: translateY(-1px);
}

/* 按钮内容布局 */
.header-btn-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}

/* 按钮图标 */
.header-btn-content i {
    font-size: 1.2rem;
    color: #72738E;
    flex-shrink: 0;
}

/* 按钮文本区域 */
.header-btn-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    flex: 1;
    min-width: 0;
}

/* 按钮标签 */
.header-btn-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    line-height: 1.2;
}

/* 按钮信息 */
.header-btn-info {
    font-size: 0.75rem;
    color: #666;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 按钮徽章（购物车数量） */
.header-btn-badge {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    background: #72738E;
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    line-height: 1;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(114, 115, 142, 0.3);
}

/* 用户按钮链接样式 */
.header-btn-link {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
    height: 100%;
}

.header-btn-link:hover {
    text-decoration: none;
    color: inherit;
}

/* 购物车按钮特殊样式 */
.cart-btn {
    position: relative;
    z-index: 1000;
}

.cart-btn:hover {
    border-color: var(--theme-color);
}

.cart-btn:hover .header-btn-content i {
    color: var(--theme-color);
}

.cart-btn .header-btn-info.has-total {
    font-weight: 600;
    color: var(--theme-color);
}

.cart-btn .header-btn-info.empty {
    font-weight: 400;
    color: #999;
}

/* 用户按钮特殊样式 */
.user-btn:hover {
    border-color: var(--theme-color);
}

.user-btn:hover .header-btn-content i {
    color: var(--theme-color);
}

/* 购物车下拉框位置调整 */
.cart-btn .cart-dropdown {
    position: absolute !important;
    top: calc(100% + 2px) !important;
    right: 0 !important;
    min-width: 420px !important;
    max-width: 480px !important;
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15) !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 99999 !important;
    max-height: 500px;
    overflow-y: auto;
    padding: 0 !important;
    display: block !important;
}

/* 购物车悬停逻辑 - 复制原有的成功逻辑 */
.cart-btn:hover .cart-dropdown,
.cart-dropdown:hover {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
}

/* 扩展购物车按钮的悬停区域，创建无缝连接 */
.cart-btn:hover::before {
    content: '';
    position: absolute;
    top: 100%;
    left: -15px;
    right: -15px;
    height: 10px;
    background: transparent;
    z-index: 99998;
}







/* 响应式调整 */
@media (max-width: 1200px) {
    .header-btn {
        min-width: 120px;
        padding: 0.625rem 0.875rem;
    }

    .header-btn-content {
        gap: 0.625rem;
    }

    .header-btn-text {
        gap: 0.1rem;
    }

    .header-btn-label {
        font-size: 0.8rem;
    }

    .header-btn-info {
        font-size: 0.7rem;
    }
}

@media (max-width: 992px) {
    .header-btn {
        min-width: 100px;
        padding: 0.5rem 0.75rem;
    }

    .header-btn-content i {
        font-size: 1.1rem;
    }

    .header-btn-label {
        font-size: 0.75rem;
    }

    .header-btn-info {
        font-size: 0.65rem;
    }

    .cart-btn .cart-dropdown {
        min-width: 320px;
        max-width: 360px;
    }
}

@media (max-width: 768px) {
    .user_tool {
        gap: 0.75rem;
    }

    .header-btn {
        min-width: 85px;
        padding: 0.5rem 0.625rem;
    }

    .header-btn-content {
        gap: 0.5rem;
    }

    .header-btn-text {
        display: none;
        /* 在小屏幕上隐藏文本，只显示图标 */
    }

    .cart-btn .cart-dropdown {
        min-width: 320px;
        max-width: 90vw;
        right: -20px;
    }
}

@media (max-width: 480px) {
    .cart-btn .cart-dropdown {
        min-width: 280px;
        right: -40px;
    }
}

/* 确保按钮在所有状态下都有正确的样式 */
.header-btn:focus,
.header-btn:active {
    outline: none;
    box-shadow: 0 0 0 3px rgba(114, 115, 142, 0.2);
}

.header-btn-link:focus {
    outline: none;
}

/* 防止按钮内容被选中 */
.header-btn-content {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* 确保图标和文本对齐 */
.header-btn-content i {
    display: flex;
    align-items: center;
    justify-content: center;
}



/* 用户登录状态样式 */
.user-btn .header-btn-info.logged-in {
    color: #9b9b9b;
    font-weight: 500;
}

/* 动画效果 */
.header-btn-badge {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* 确保按钮在不同浏览器中的一致性 */
.header-btn {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-style: solid;
    box-sizing: border-box;
}