/* 按钮组件 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--text-white);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: scale(0.96);
    box-shadow: var(--shadow-sm);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--border-radius-full);
}

.btn-lg {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--font-size-md);
}

.btn-sm {
    padding: 6px 12px;
    font-size: var(--font-size-xs);
    gap: 4px;
}

.btn-sm svg {
    width: 14px;
    height: 14px;
}

.btn-block {
    width: 100%;
}

/* 按钮内图标大小 */
.btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn-sm svg {
    width: 14px;
    height: 14px;
}

.btn-lg svg {
    width: 22px;
    height: 22px;
}

/* 输入框组件 */
.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.input-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

.input {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-md);
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    outline: none;
}

.input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* 确保模态框中的输入框可以正常交互 */
.modal-body .input {
    pointer-events: auto;
    touch-action: auto;
}

.input-textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

/* 头像组件 */
.avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-full);
    background: #e8e8ee;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    color: #888899;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-sm { width: 36px; height: 36px; }
.avatar-lg { width: 64px; height: 64px; }
.avatar-xl { width: 80px; height: 80px; }

/* 头部导航 */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    min-height: var(--header-height);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.header-gradient {
    background: var(--gradient-header);
    border-bottom: none;
}

.header-gradient .header-title,
.header-gradient .btn-icon {
    color: var(--text-white);
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.header-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
}

/* 列表组件 */
.list {
    display: flex;
    flex-direction: column;
}

.list-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.list-item:active {
    background: var(--bg-primary);
}

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

.list-item-title {
    font-size: var(--font-size-md);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.list-item-subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--spacing-xs);
}

.list-item-time {
    font-size: var(--font-size-xs);
    color: var(--text-light);
}

/* 徽章 */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--primary-color);
    color: var(--text-white);
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--border-radius-full);
}

/* 模态框容器 */
#modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    pointer-events: none;
}

#modal-container:has(.modal-overlay.active),
#modal-container:has(.bottom-sheet.active) {
    pointer-events: auto;
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    pointer-events: none;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal {
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-xl);
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-spring);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.modal-body {
    padding: var(--spacing-lg);
    overflow-y: auto;
    max-height: 60vh;
}

.modal-footer {
    display: flex;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

/* 底部弹出框 */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-xl) var(--border-radius-xl) 0 0;
    padding-bottom: var(--safe-bottom);
    transform: translateY(100%);
    transition: transform var(--transition-spring);
    z-index: 1001;
    max-height: 80vh;
    overflow-y: auto;
    pointer-events: auto;
}

.bottom-sheet.active {
    transform: translateY(0);
}

.bottom-sheet .list-item {
    pointer-events: auto;
}

.bottom-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin: var(--spacing-sm) auto var(--spacing-md);
}

/* Toast提示 */
#toast-container {
    position: fixed;
    top: calc(var(--safe-top) + var(--spacing-lg));
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    pointer-events: none;
}

.toast {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--text-primary);
    color: var(--bg-primary);
    border-radius: var(--border-radius-full);
    font-size: var(--font-size-sm);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
}

/* 开关 */
.switch {
    position: relative;
    width: 52px;
    height: 32px;
    background: var(--border-color);
    border-radius: var(--border-radius-full);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.switch.active {
    background: var(--primary-color);
}

.switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 28px;
    height: 28px;
    background: white;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast);
}

.switch.active::after {
    transform: translateX(20px);
}

/* 滑块 */
.slider-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.slider {
    flex: 1;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    appearance: none;
    outline: none;
}

.slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.slider-value {
    min-width: 40px;
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* 卡片 */
.card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-sm);
}

/* SVG图标基础样式 */
.icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.icon-sm { width: 18px; height: 18px; }
.icon-lg { width: 32px; height: 32px; }
