/**
 * 弹框组件样式
 *
 * 包含 alert、confirm、loading 等弹框的样式
 */

/* 遮罩层 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(4px);
    /* BUG-040: 必须高于 .audio-player-container (--z-player)，
       否则底部播放器会遮挡弹窗按钮。 */
    z-index: var(--z-modal-overlay);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-overlay.modal-overlay-top {
    z-index: calc(var(--z-modal-overlay) + 20);
}

/* 弹框主体 */
.modal {
    background: white;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-xl);
    animation: modal-in 0.2s ease;
    /* 约束高度 + flex 布局：body 滚动、header/footer 始终可见 */
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    z-index: var(--z-modal-content);
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(-8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 对话框变体 */
.modal-dialog {
    max-width: 380px;
    text-align: center;
}

.modal-dialog .modal-header {
    padding: 32px 24px 20px;
    border-bottom: none;
}

.modal-dialog .modal-footer {
    justify-content: center;
    background: transparent;
    border-top: none;
    padding-top: 0;
}

/* 头部 */
.modal-header {
    padding: 24px;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.modal-message {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-sub);
}

/* 底部 */
.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 20px 24px;
    background: var(--neutral-50);
    border-top: 1px solid var(--border-light);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    flex-shrink: 0;   /* 配合 .modal 的 flex 布局：footer 不参与滚动 */
}

/* 图标 */
.modal-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.modal-icon.icon-info {
    background: var(--brand-primary-soft);
    color: var(--brand-primary);
}

.modal-icon.icon-success {
    background: var(--color-success-soft);
    color: var(--color-success);
}

.modal-icon.icon-warning {
    background: var(--color-warning-soft);
    color: var(--color-warning);
}

.modal-icon.icon-error {
    background: var(--color-danger-soft);
    color: var(--color-danger);
}

.modal-icon.icon-confirm {
    background: var(--brand-primary-soft);
    color: var(--brand-primary);
}

.modal-icon.icon-loading {
    background: var(--brand-primary-soft);
    color: var(--brand-primary);
}

/* 加载动画 */
.modal-icon .spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 弹框按钮 */
.modal .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 100px;
    min-height: var(--tap-control-min-h);
}

.modal .btn-primary {
    background: var(--brand-primary);
    color: white;
}

.modal .btn-primary:hover {
    background: var(--brand-primary-hover);
}

.modal .btn-secondary {
    background: white;
    color: var(--neutral-600);
    border: 1px solid var(--neutral-200);
}

.modal .btn-secondary:hover {
    background: var(--neutral-50);
    border-color: var(--neutral-300);
}

.modal .btn-danger {
    background: var(--color-danger);
    color: white;
}

.modal .btn-danger:hover {
    background: #dc2626;
}

/* ========== 删除确认框样式 ========== */

/* 删除图标 - 红色渐变 */
.modal-icon.icon-delete {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    color: #dc2626;
    animation: deleteIconPulse 0.4s ease-out;
}

@keyframes deleteIconPulse {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* 删除预览卡片 */
.delete-preview-card {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 14px 16px;
    margin: 16px 0;
    text-align: left;
}

.delete-preview-content {
    font-size: 0.9rem;
    color: #1f2937;
    line-height: 1.5;
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.delete-preview-subtitle {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 6px;
}

.delete-preview-subtitle::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    background: #9ca3af;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

/* 删除警告文字 */
.delete-warning {
    font-size: 0.8rem;
    color: #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.delete-warning::before {
    content: '\26A0';
    font-size: 0.9rem;
}

/* ========== 导入会议弹窗样式 ========== */

/* 导入弹窗尺寸 */
.modal-import {
    max-width: 480px;
}

/* 表单相关 */
.modal-body {
    padding: 0 24px 24px;
    overflow-y: auto;     /* 配合 .modal 的 flex 布局：body 滚动 */
    flex: 1 1 auto;       /* 占满中间可滚动区 */
    min-height: 0;        /* flex 子项允许收缩 */
}

.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    min-height: var(--tap-control-min-h);
    padding: 12px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-main);
    background: white;
    transition: all var(--transition-fast);
    box-sizing: border-box;
}

@media (max-width: 520px) {
    .modal-overlay {
        align-items: flex-end;
        padding: 12px;
    }

    .modal {
        max-height: calc(100dvh - 24px);
        border-radius: 18px;
    }

    .modal-header {
        padding: 20px 18px 14px;
    }

    .modal-body {
        padding: 0 18px 18px;
    }

    .modal-footer {
        display: grid;
        grid-template-columns: 1fr;
        padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px));
        border-radius: 0 0 18px 18px;
    }

    .modal-footer .btn,
    .modal .btn {
        width: 100%;
    }
}

.form-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-soft);
}

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

/* 文件拖拽区域 */
.file-drop-zone {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-md);
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--neutral-50);
}

.file-drop-zone:hover {
    border-color: var(--brand-primary);
    background: var(--brand-primary-soft);
}

.file-drop-zone.drag-over {
    border-color: var(--brand-primary);
    background: var(--brand-primary-soft);
    border-style: solid;
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.drop-zone-icon {
    color: var(--text-muted);
}

.drop-zone-icon svg {
    width: 32px;
    height: 32px;
}

.drop-zone-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    margin: 0;
}

.drop-zone-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

/* 文件预览 */
.drop-zone-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-info svg {
    color: var(--brand-primary);
    flex-shrink: 0;
}

.file-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-remove-file {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: var(--neutral-100);
    color: var(--text-sub);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-remove-file:hover {
    background: var(--color-danger-soft);
    color: var(--color-danger);
}

/* ========== 导入进度弹窗样式 ========== */

.modal-progress {
    max-width: 420px;
}

.modal-progress .modal-header {
    padding-bottom: 16px;
}

.modal-progress .modal-body {
    padding: 0 24px 32px;
}

.modal-subtitle {
    font-size: 14px;
    color: var(--text-sub);
    margin: 0;
}

/* 进度条容器 */
.progress-container {
    margin-bottom: 24px;
}

.progress-bar {
    height: 8px;
    background: var(--neutral-100);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-primary) 0%, var(--brand-secondary, #8b5cf6) 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-text {
    font-size: 13px;
    color: var(--text-sub);
}

.progress-percent {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-primary);
}

/* 进度步骤 */
.progress-steps {
    display: flex;
    justify-content: space-between;
    padding: 0 8px;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0.4;
    transition: all var(--transition-fast);
}

.progress-step.active {
    opacity: 1;
}

.progress-step.completed {
    opacity: 1;
}

.progress-step.completed .step-icon {
    transform: scale(1.1);
}

.step-icon {
    font-size: 20px;
    transition: transform var(--transition-fast);
}

.step-label {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.progress-step.active .step-label {
    color: var(--brand-primary);
    font-weight: 500;
}

.progress-step.completed .step-label {
    color: var(--color-success);
}

/* 失败状态 */
.progress-step.failed {
    opacity: 1;
}

.progress-step.failed .step-icon {
    color: var(--color-danger);
}

.progress-step.failed .step-icon svg {
    stroke: var(--color-danger);
}

.progress-step.failed .step-label {
    color: var(--color-danger);
}

/* 导入按钮样式 */
.modal .btn svg {
    margin-right: 6px;
}

.modal .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== 导入操作栏 ========== */

.import-action-bar {
    margin-top: 16px;
    display: flex;
    justify-content: center;
}

.btn-text-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-sub);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-text-icon:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    background: var(--brand-primary-soft);
}

.btn-text-icon svg {
    opacity: 0.7;
}

.btn-text-icon:hover svg {
    opacity: 1;
}

/* ========== 上传进度条 ========== */

.upload-progress {
    margin-top: 16px;
}

.upload-progress-bar {
    height: 6px;
    background: var(--neutral-100);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-primary) 0%, var(--brand-secondary, #8b5cf6) 100%);
    border-radius: 3px;
    transition: width 0.2s ease;
}

.upload-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.upload-progress-text {
    color: var(--text-sub);
}

.upload-progress-percent {
    color: var(--brand-primary);
    font-weight: 500;
}

/* ========== 进度步骤图标样式更新 ========== */

.progress-step .step-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.progress-step .step-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.progress-step.active .step-icon svg {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.progress-step.completed .step-icon svg {
    stroke: var(--color-success);
}

.modal .btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-primary-soft); }
