/* ==================== 共享组件样式 ==================== */
/* 使用统一变量系统 (variables.css) */

/* ==================== AppHeader 顶部导航栏 ==================== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-fixed);
    height: var(--header-height);
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-4);
    padding-top: var(--safe-top);
}

.app-header__left,
.app-header__right {
    display: flex;
    align-items: center;
    min-width: 44px;
    height: 100%;
}

.app-header__back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    transition: background-color var(--duration-fast);
}

.app-header__back:active {
    background-color: var(--bg-secondary);
}

.app-header__back-icon {
    width: 20px;
    height: 20px;
    color: var(--text-primary);
}

.app-header__title {
    flex: 1;
    text-align: center;
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    padding: 0 var(--space-3);
}

.app-header__action {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 var(--space-1);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    color: var(--gold-primary);
    transition: background-color var(--duration-fast);
}

.app-header__action:active {
    background-color: var(--bg-secondary);
}

.app-header__action-icon {
    width: 20px;
    height: 20px;
    color: var(--text-primary);
}

/* 透明Header变体 */
.app-header--transparent {
    background-color: transparent;
    border-bottom: none;
}

.app-header--transparent .app-header__title,
.app-header--transparent .app-header__back-icon,
.app-header--transparent .app-header__action-icon {
    color: var(--text-primary);
}

/* ==================== BottomNav 底部Tab导航 ==================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-fixed);
    height: calc(var(--nav-height) + var(--safe-bottom));
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: flex-start;
    justify-content: space-around;
    padding-top: var(--space-2);
    padding-bottom: var(--safe-bottom);
}

.bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: var(--nav-height);
    padding: var(--space-2) 0;
    transition: color var(--duration-fast);
    cursor: pointer;
}

.bottom-nav__icon {
    width: 24px;
    height: 24px;
    margin-bottom: 2px;
    color: var(--text-tertiary);
    transition: all var(--duration-normal) var(--ease-spring);
}

.bottom-nav__text {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    transition: color var(--duration-fast);
}

/* 激活状态 */
.bottom-nav__item.active .bottom-nav__icon {
    color: var(--gold-primary);
    transform: scale(1.1);
}

.bottom-nav__item.active .bottom-nav__text {
    color: var(--gold-primary);
    font-weight: var(--weight-medium);
}

/* 点击动画 */
.bottom-nav__item:active {
    opacity: 0.7;
}

/* ==================== Toast 提示消息 ==================== */
.toast-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: var(--z-toast);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    max-width: 280px;
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-lg);
    background-color: rgba(0, 0, 0, 0.8);
    color: var(--text-primary);
    font-size: var(--text-base);
    text-align: center;
    opacity: 0;
    transform: scale(0.9);
    transition: all var(--duration-normal) var(--ease-out);
}

.toast.show {
    opacity: 1;
    transform: scale(1);
}

.toast__icon {
    width: 20px;
    height: 20px;
    margin-right: var(--space-3);
    flex-shrink: 0;
}

/* Toast类型变体 */
.toast--success {
    background-color: var(--accent-green);
}

.toast--error {
    background-color: var(--accent-red);
}

.toast--info {
    background-color: var(--accent-blue);
}

.toast--warning {
    background-color: var(--accent-orange);
}

/* 顶部Toast */
.toast-container--top {
    top: calc(var(--header-height) + var(--space-6));
    transform: translateX(-50%);
}

.toast-container--top .toast {
    transform: translateY(-20px);
}

.toast-container--top .toast.show {
    transform: translateY(0);
}

/* 底部Toast */
.toast-container--bottom {
    top: auto;
    bottom: calc(var(--nav-height) + var(--space-6) + var(--safe-bottom));
    transform: translateX(-50%);
}

.toast-container--bottom .toast {
    transform: translateY(20px);
}

.toast-container--bottom .toast.show {
    transform: translateY(0);
}

/* ==================== Loading 加载状态 ==================== */
/* 旋转加载器 */
.loading-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.loading-spinner__circle {
    width: 100%;
    height: 100%;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--gold-primary);
    border-radius: var(--radius-full);
    animation: loading-spin 1s linear infinite;
}

@keyframes loading-spin {
    to {
        transform: rotate(360deg);
    }
}

/* 加载器尺寸变体 */
.loading-spinner--sm {
    width: 20px;
    height: 20px;
}

.loading-spinner--sm .loading-spinner__circle {
    border-width: 2px;
}

.loading-spinner--lg {
    width: 60px;
    height: 60px;
}

.loading-spinner--lg .loading-spinner__circle {
    border-width: 4px;
}

/* 页面加载遮罩 */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-overlay);
}

.loading-overlay__text {
    margin-top: var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* 骨架屏 */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 25%,
        rgba(139, 157, 195, 0.3) 50%,
        var(--bg-secondary) 75%
    );
    background-size: 200% 100%;
    border-radius: var(--radius-md);
    animation: skeleton-loading var(--duration-slower) ease-in-out infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton--text {
    height: 16px;
    margin-bottom: var(--space-3);
}

.skeleton--title {
    height: 24px;
    width: 60%;
    margin-bottom: var(--space-4);
}

.skeleton--avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
}

.skeleton--image {
    width: 100%;
    aspect-ratio: 16 / 9;
}

.skeleton--card {
    padding: var(--space-4);
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
}

/* 骨架屏容器 */
.skeleton-list {
    padding: var(--space-4);
}

.skeleton-list__item {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--border-subtle);
}

.skeleton-list__item:last-child {
    border-bottom: none;
}

.skeleton-list__content {
    flex: 1;
}

/* ==================== Modal 弹窗 ==================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: var(--z-overlay);
    background-color: var(--bg-overlay);
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-normal);
}

.modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: var(--z-modal);
    transform: translate(-50%, -50%) scale(0.9);
    width: calc(100% - var(--space-8) * 2);
    max-width: 320px;
    background-color: var(--bg-primary);
    border-radius: var(--radius-xl);
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-normal) var(--ease-out);
}

.modal.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.modal__header {
    padding: var(--space-6) var(--space-6) var(--space-4);
    text-align: center;
}

.modal__title {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
}

.modal__body {
    padding: 0 var(--space-6) var(--space-6);
    font-size: var(--text-base);
    color: var(--text-secondary);
    text-align: center;
    line-height: var(--leading-relaxed);
}

.modal__footer {
    display: flex;
    border-top: 1px solid var(--border-subtle);
}

.modal__btn {
    flex: 1;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-base);
    transition: background-color var(--duration-fast);
}

.modal__btn:first-child {
    border-right: 1px solid var(--border-subtle);
}

.modal__btn--cancel {
    color: var(--text-secondary);
}

.modal__btn--confirm {
    color: var(--gold-primary);
    font-weight: var(--weight-medium);
}

.modal__btn:active {
    background-color: var(--bg-secondary);
}

/* 底部弹出Modal */
.modal--bottom {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: translateY(100%);
    width: 100%;
    max-width: none;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal--bottom.show {
    transform: translateY(0);
}

.modal--bottom .modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
}

.modal--bottom .modal__close {
    width: 24px;
    height: 24px;
    color: var(--text-tertiary);
}

/* ==================== 微信弹窗样式 ==================== */
.wechat-modal {
    text-align: center;
}

.wechat-modal__qrcode {
    width: 200px;
    height: 200px;
    margin: 0 auto var(--space-4);
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wechat-modal__qrcode img {
    width: 180px;
    height: 180px;
}

.wechat-modal__tip {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

/* ==================== 搜索弹窗 ==================== */
.search-modal__input-wrap {
    display: flex;
    align-items: center;
    padding: var(--space-4) var(--space-6);
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    margin: 0 var(--space-6) var(--space-4);
}

.search-modal__input {
    flex: 1;
    height: 36px;
    padding: 0 var(--space-3);
    font-size: var(--text-base);
    background: transparent;
}

.search-modal__icon {
    width: 20px;
    height: 20px;
    color: var(--text-tertiary);
}

.search-modal__clear {
    width: 20px;
    height: 20px;
    color: var(--text-tertiary);
    opacity: 0;
    transition: opacity var(--duration-fast);
}

.search-modal__input-wrap.has-value .search-modal__clear {
    opacity: 1;
}

.search-modal__history {
    padding: 0 var(--space-6);
}

.search-modal__history-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

.search-modal__history-clear {
    color: var(--gold-primary);
}

.search-modal__history-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.search-modal__history-item {
    padding: var(--space-2) var(--space-4);
    background-color: var(--bg-secondary);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* ==================== Button 按钮 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 var(--space-6);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
    transition: all var(--duration-fast);
}

.btn--primary {
    background-color: var(--gold-primary);
    color: var(--bg-primary);
}

.btn--primary:active {
    background-color: var(--gold-dark);
}

.btn--secondary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.btn--secondary:active {
    background-color: rgba(139, 157, 195, 0.3);
}

.btn--outline {
    border: 1px solid var(--border-medium);
    background-color: transparent;
    color: var(--text-primary);
}

.btn--outline:active {
    background-color: var(--bg-secondary);
}

.btn--ghost {
    background-color: transparent;
    color: var(--gold-primary);
}

.btn--ghost:active {
    background-color: var(--bg-secondary);
}

/* 按钮尺寸 */
.btn--sm {
    height: 32px;
    padding: 0 var(--space-4);
    font-size: var(--text-sm);
}

.btn--lg {
    height: 48px;
    padding: 0 var(--space-8);
    font-size: var(--text-lg);
}

.btn--block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* ==================== Card 卡片 ==================== */
.card {
    background-color: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
}

.card__title {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
}

.card__body {
    padding: var(--space-6);
}

.card__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-subtle);
}

/* ==================== List 列表 ==================== */
.list {
    background-color: var(--bg-primary);
}

.list-item {
    display: flex;
    align-items: center;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item__icon {
    width: 24px;
    height: 24px;
    margin-right: var(--space-4);
    color: var(--text-tertiary);
}

.list-item__content {
    flex: 1;
}

.list-item__title {
    font-size: var(--text-base);
    color: var(--text-primary);
}

.list-item__desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: 2px;
}

.list-item__arrow {
    width: 16px;
    height: 16px;
    margin-left: var(--space-3);
    color: var(--text-tertiary);
}

/* ==================== Badge 徽章 ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-full);
    background-color: var(--accent-red);
    color: var(--text-primary);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
}

.badge--dot {
    min-width: 8px;
    width: 8px;
    height: 8px;
    padding: 0;
}

/* ==================== Empty 空状态 ==================== */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px var(--space-6);
}

.empty__icon {
    width: 80px;
    height: 80px;
    margin-bottom: var(--space-4);
    color: var(--text-tertiary);
}

.empty__text {
    font-size: var(--text-base);
    color: var(--text-secondary);
}

.empty__action {
    margin-top: var(--space-6);
}

/* ==================== Divider 分割线 ==================== */
.divider {
    display: flex;
    align-items: center;
    margin: var(--space-6) 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--border-subtle);
}

.divider__text {
    padding: 0 var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}