/* ===== 我的合成历史页面 ===== */
.page-main .container {
    max-width: min(98%, 1920px);
    width: 98%;
}

.page-main {
    padding-top: 100px;
    padding-bottom: 60px;
    min-height: calc(100vh - 60px);
    background: var(--bg);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.page-subtitle {
    color: var(--text-mid);
    font-size: 14px;
}

/* 统计卡片 */
.stats-cards {
    display: flex;
    gap: 12px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 12px 20px;
    box-shadow: var(--shadow);
    text-align: center;
    min-width: 88px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

.stat-success .stat-value { color: var(--success); }
.stat-processing .stat-value { color: var(--accent); }
.stat-failed .stat-value { color: #EF4444; }

/* 筛选条 */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--white);
    padding: 16px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 12px;
    color: var(--text-light);
}

.input-date,
.input-select {
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--text-dark);
    background: var(--white);
    outline: none;
    transition: var(--transition);
    min-width: 140px;
}

.input-date:focus,
.input-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(43, 95, 215, 0.1);
}

.btn-filter {
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    height: 38px;
}

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

.btn-reset {
    background: var(--white);
    color: var(--text-mid);
    border: 1px solid #E2E8F0;
}

.btn-reset:hover {
    background: #F1F5F9;
}

/* 列表 */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    display: flex;
    flex-wrap: wrap;  /* 允许 audio-player 换行到下一行，避免破坏原横向布局 */
    align-items: center;
    gap: 16px;
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.history-item:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.item-index {
    font-size: 14px;
    color: var(--text-light);
    min-width: 32px;
}

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

.item-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-light);
}

.item-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.item-type {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.type-listening {
    background: #DBEAFE;
    color: #1E40AF;
}

.type-role,
.type-dialogue {
    background: #FFE4C4;
    color: #D45A00;
}

.type-tts {
    background: #DCFCE7;
    color: #166534;
}

.status-tag {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.status-success {
    background: #DCFCE7;
    color: #166534;
}

.status-processing {
    background: #FEF3C7;
    color: #92400E;
}

.status-failed {
    background: #FEE2E2;
    color: #991B1B;
}

.item-actions {
    display: flex;
    gap: 8px;
}

.btn-action {
    background: var(--white);
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text-mid);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
}

.btn-action:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-action.btn-play {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

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

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid #E2E8F0;
    background: var(--white);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-mid);
    cursor: pointer;
    transition: var(--transition);
}

.page-btn.page-nav {
    min-width: 80px;
    padding: 0 16px;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-text {
    color: var(--text-mid);
    margin-bottom: 20px;
}

.btn-empty {
    display: inline-block;
    background: var(--primary);
    color: var(--white);
    padding: 10px 24px;
    border-radius: var(--radius-btn);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
}

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

/* 编辑标题弹窗 */
.edit-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.edit-modal-content {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    width: 90%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.edit-modal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.edit-input {
    width: 100%;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    margin-bottom: 16px;
    outline: none;
}

.edit-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(43, 95, 215, 0.1);
}

.edit-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* 音频播放器：插入到 history-item 末尾，强制占满整行（换到下一行） */
.audio-player {
    flex-basis: 100%;  /* 在 flex-wrap 容器中强制独占一行 */
    width: 100%;
    margin-top: 12px;
}

.audio-player audio {
    width: 100%;
}

/* 响应式 */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-cards {
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .history-item {
        flex-wrap: wrap;
    }

    .item-meta {
        flex-wrap: wrap;
        gap: 8px;
    }
}
