/* ========== 通用组件 ========== */

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-lg);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    border: 2px solid var(--stroke);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    position: relative;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.95) translateY(1px);
}

.btn-primary {
    background: var(--pink);
    color: var(--stroke);
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    background: var(--pink-dark);
}

.btn-secondary {
    background: var(--white);
    color: var(--stroke);
    box-shadow: var(--shadow-soft);
}

.btn-secondary:hover {
    background: var(--cream);
}

.btn-small {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8rem;
}

.btn-large {
    padding: var(--space-md) var(--space-xl);
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.btn-add {
    width: 100%;
    margin-top: var(--space-md);
    background: var(--mint);
}

.btn-add:hover {
    background: var(--sky);
}

/* 图标按钮 */
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 2px solid var(--stroke);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--stroke);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-soft);
}

.btn-icon:hover {
    background: var(--cream);
    transform: scale(1.05);
}

.btn-icon:active {
    transform: scale(0.92);
}

.btn-send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 2px solid var(--stroke);
    border-radius: var(--radius-full);
    background: var(--pink);
    color: var(--stroke);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    box-shadow: var(--shadow-soft);
}

.btn-send:hover {
    background: var(--pink-dark);
    transform: scale(1.08);
}

.btn-send:active {
    transform: scale(0.92);
}

.btn-send:disabled {
    background: var(--peach-light);
    cursor: not-allowed;
    transform: none;
}

.btn-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 2px solid var(--stroke);
    border-radius: var(--radius-full);
    background: var(--white);
    color: var(--stroke);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
}

.btn-close:hover {
    background: var(--pink);
    transform: rotate(90deg);
}

/* 表单 */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--stroke);
    margin-bottom: var(--space-xs);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-family: inherit;
    font-size: 0.9rem;
    border: 2px solid var(--stroke);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--text);
    outline: none;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--pink-dark);
    box-shadow: 0 0 0 3px var(--pink-light);
}

.form-group input::placeholder {
    color: var(--text-light);
}

.model-row {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.model-row select {
    flex: 1;
}

.btn-fetch {
    background: var(--lavender);
    white-space: nowrap;
}

.btn-fetch:hover {
    background: var(--lavender-light);
}

/* 区块 */
.section {
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 2px dashed var(--peach);
}

.section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.section-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--stroke);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* 预设卡片 */
.preset-card {
    background: var(--white);
    border: 2px solid var(--stroke);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-soft);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.preset-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.preset-card.active {
    border-color: var(--pink-dark);
    background: var(--pink-light);
}

.preset-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xs);
}

.preset-name {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--stroke);
}

.preset-actions {
    display: flex;
    gap: var(--space-xs);
}

.btn-action {
    width: 28px;
    height: 28px;
    border: 2px solid var(--stroke);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--stroke);
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-action:hover {
    background: var(--cream);
    transform: scale(1.1);
}

.btn-action.delete:hover {
    background: var(--pink);
}

.preset-info {
    font-size: 0.75rem;
    color: var(--text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preset-model {
    font-size: 0.8rem;
    color: var(--stroke-light);
    margin-top: var(--space-xs);
    font-weight: 600;
}

/* 备份按钮 */
.backup-btns {
    display: flex;
    gap: var(--space-md);
}

.backup-btns .btn {
    flex: 1;
}

/* 搜索框 */
.search-box {
    margin-bottom: var(--space-md);
}

.search-box input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-family: inherit;
    font-size: 0.9rem;
    border: 2px solid var(--stroke);
    border-radius: var(--radius-full);
    background: var(--white);
    color: var(--text);
    outline: none;
    transition: var(--transition);
}

.search-box input:focus {
    border-color: var(--pink-dark);
    box-shadow: 0 0 0 3px var(--pink-light);
}

/* 历史记录项 */
.history-item {
    background: var(--white);
    border: 2px solid var(--stroke);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-soft);
}

.history-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow);
    background: var(--cream-light);
}

.history-item.active {
    background: var(--mint-light);
    border-color: var(--mint);
}

.history-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--stroke);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-meta {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 2px;
    display: flex;
    justify-content: space-between;
}

/* 图片预览 */
.photo-preview {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
    padding: var(--space-sm);
    background: var(--cream-light);
    border: 2px solid var(--stroke);
    border-radius: var(--radius-md);
    width: fit-content;
}

.photo-preview img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 2px solid var(--stroke);
}

.btn-remove-photo {
    width: 24px;
    height: 24px;
    border: 2px solid var(--stroke);
    border-radius: var(--radius-full);
    background: var(--pink);
    color: var(--stroke);
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-remove-photo:hover {
    background: var(--pink-dark);
    transform: scale(1.1);
}

/* 可爱弹窗 */
.cute-alert {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}

.cute-alert.hidden {
    display: none;
}

.cute-alert-overlay {
    position: absolute;
    inset: 0;
    background: rgba(93, 64, 55, 0.4);
    backdrop-filter: blur(3px);
}

.cute-alert-box {
    position: relative;
    background: var(--white);
    border: 3px solid var(--stroke);
    border-radius: var(--radius-xl);
    padding: var(--space-xxl);
    width: 100%;
    max-width: 340px;
    text-align: center;
    box-shadow: var(--shadow);
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cute-alert-icon {
    margin-bottom: var(--space-md);
}

.cute-alert-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--stroke);
    margin-bottom: var(--space-sm);
}

.cute-alert-msg {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: var(--space-xl);
    white-space: pre-line;
    word-break: break-word;
}

.cute-alert-btn {
    width: 100%;
    font-size: 1rem;
    padding: var(--space-md) var(--space-xl);
}

/* 消息操作栏 */
.message-actions {
    display: flex;
    gap: var(--space-md);
    padding: 0 var(--space-xs);
    margin-top: 2px;
    font-size: 0.7rem;
    color: var(--text-light);
    opacity: 0.6;
    transition: opacity 0.2s;
}

.message:hover .message-actions {
    opacity: 1;
}

.message-action-btn {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-family: inherit;
}

.message-action-btn:hover {
    color: var(--stroke);
    background: var(--cream-light);
}

/* 隐藏 */
.hidden {
    display: none !important;
}
