/*
╔══════════════════════════════════════════════════════════╗
║  modal.css - 所有弹窗样式                                ║
║  📌 AI录入弹窗 + 删除确认弹窗 + 录音全屏遮罩              ║
╚══════════════════════════════════════════════════════════╝
*/

/* === 删除确认弹窗 === */
.delete-modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.65); backdrop-filter: blur(4px); z-index: 600; justify-content: center; align-items: center; }
.delete-modal-overlay.show { display: flex; }
.delete-modal { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-xl); width: 88%; max-width: 380px; padding: 24px; box-shadow: 0 16px 48px rgba(0,0,0,0.5); animation: modalIn 0.25s ease; }
.delete-modal h3 { font-size: 17px; margin-bottom: 6px; }
.delete-modal p { font-size: 13px; color: var(--text-secondary); margin-bottom: 18px; }
.delete-btns { display: flex; flex-direction: column; gap: 8px; }
.delete-btn { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-elevated); color: var(--text-primary); font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; text-align: left; display: flex; align-items: center; gap: 10px; transition: all 0.15s; }
.delete-btn:hover { background: var(--bg-card-hover); }
.delete-btn.danger { border-color: rgba(239,68,68,0.25); }
.delete-btn.danger:hover { background: rgba(239,68,68,0.08); }
.delete-btn.warn { border-color: rgba(245,158,11,0.25); }
.delete-btn.warn:hover { background: rgba(245,158,11,0.08); }
.delete-btn .dicon { font-size: 18px; width: 24px; text-align: center; }
.delete-btn-cancel { padding: 10px; border: none; background: none; color: var(--text-muted); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; text-align: center; margin-top: 4px; }

/* === AI录入弹窗（从底部滑入） === */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(6px); z-index: 500; justify-content: center; align-items: flex-end; }
.modal-overlay.show { display: flex; }
.modal-box { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-xl) var(--radius-xl) 0 0; width: 100%; max-width: 520px; padding: 24px 20px calc(20px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -10px 40px rgba(0,0,0,0.4); animation: slideUp 0.3s ease; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h2 { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 22px; cursor: pointer; padding: 4px; }
.modal-close:hover { color: var(--text-primary); }
/* 步骤指示器 */
.step-indicator { display: flex; gap: 4px; margin-bottom: 16px; }
.step-dot { flex: 1; height: 3px; border-radius: 2px; background: var(--border); transition: background 0.3s; }
.step-dot.active { background: var(--primary); }
.step-dot.done { background: var(--success); }
.step-section { display: none; }
.step-section.active { display: block; }
.step-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; color: var(--text-secondary); }
.ai-textarea { width: 100%; height: 80px; padding: 12px 14px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text-primary); font-size: 14px; font-family: inherit; resize: none; margin-bottom: 12px; }
.ai-textarea:focus { outline: none; border-color: var(--primary); }
.input-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.voice-toggle-btn { flex: 1; height: 44px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); font-size: 14px; font-weight: 600; color: var(--text-primary); cursor: pointer; font-family: inherit; display: flex; justify-content: center; align-items: center; gap: 7px; transition: all 0.15s; }
.voice-toggle-btn.recording { background: rgba(239,68,68,0.1); border-color: var(--danger); color: var(--danger); animation: recPulse 1.5s infinite; }
.confirm-text-btn { height: 44px; padding: 0 20px; background: var(--primary); color: white; border: none; border-radius: var(--radius-md); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; display: flex; align-items: center; gap: 5px; transition: all 0.12s; }
.confirm-text-btn:hover { background: var(--primary-dark); }
.confirm-text-btn:disabled { opacity: 0.4; cursor: not-allowed; }
/* 预览列表 */
.preview-list { margin-bottom: 14px; }
.preview-item { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; }
.preview-item-info { flex: 1; }
.preview-item-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.preview-item-detail { font-size: 12px; color: var(--text-muted); }
.preview-item-qty { font-size: 20px; font-weight: 700; color: var(--primary); font-family: 'DM Sans'; }
.preview-item-remove { background: none; border: none; color: var(--text-muted); font-size: 14px; cursor: pointer; padding: 4px; margin-left: 8px; }
.preview-item-remove:hover { color: var(--danger); }
.preview-actions { display: flex; gap: 8px; }
.preview-back-btn { flex: 1; height: 44px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); font-size: 13px; font-weight: 600; color: var(--text-secondary); cursor: pointer; font-family: inherit; }
.preview-confirm-btn { flex: 2; height: 44px; background: var(--success); color: white; border: none; border-radius: var(--radius-md); font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit; display: flex; align-items: center; justify-content: center; gap: 6px; transition: all 0.12s; }
.preview-confirm-btn:hover { background: #0EA572; }
.modal-status { text-align: center; margin-top: 10px; font-size: 11.5px; color: var(--text-muted); min-height: 16px; }

/* === 录音全屏遮罩 === */
.recording-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.92); z-index: 9999; justify-content: center; align-items: center; flex-direction: column; color: white; }
.recording-box { text-align: center; }
.visualizer { display: flex; gap: 5px; justify-content: center; height: 48px; align-items: center; margin-bottom: 20px; }
.bar { width: 5px; background: var(--primary); border-radius: 3px; animation: bounce 0.5s infinite ease-in-out; }
.bar:nth-child(2) { animation-delay: 0.1s; height: 28px; }
.bar:nth-child(3) { animation-delay: 0.2s; height: 38px; }
.bar:nth-child(4) { animation-delay: 0.1s; height: 28px; }
.bar:nth-child(1),.bar:nth-child(5) { height: 18px; }
.recording-text { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.recording-hint { color: #777; font-size: 12px; margin-bottom: 20px; }
.stop-rec-btn { padding: 12px 32px; background: var(--danger); color: white; border: none; border-radius: 24px; font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit; display: flex; align-items: center; gap: 8px; margin: 0 auto; }
.stop-rec-btn:active { transform: scale(0.95); }

/* 电脑端弹窗居中 */
@media (min-width: 768px) {
    .modal-box { border-radius: var(--radius-xl); max-height: 80vh; align-self: center; }
}
