/**
 * 主CSS文件 - 导入所有模块化CSS文件
 * 按照优先级顺序导入：基础 -> 布局 -> 组件 -> 页面 -> 主题
 */

/* =================================
   基础层 - 变量、重置、工具类
   ================================= */
@import url('./base/variables.css');
@import url('./base/reset.css');
@import url('./base/utilities.css');

/* =================================
   布局层 - 网格、头部、容器
   ================================= */
@import url('./layout/grid.css');
@import url('./layout/header.css');

/* =================================
   组件层 - 可重用组件
   ================================= */
@import url('./components/buttons.css');
@import url('./components/forms.css');
@import url('./components/cards.css');
@import url('./components/animations.css');

/* =================================
   页面层 - 特定页面样式
   ================================= */
@import url('./pages/workspace.css');

/* =================================
   现有模块兼容 - 保持向后兼容
   ================================= */
@import url('./multi-order-cards.css');

/* =================================
   多订单模块移动端样式
   ================================= */
@import url('./multi-order/mobile.css');

/* =================================
   全局应用样式
   ================================= */
#app {
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    overflow: hidden;
    box-sizing: border-box;
}

/* =================================
   价格管理器手动编辑模式样式
   ================================= */
.price-conversion-display {
    margin-top: 10px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

.price-conversion-display.manual-edit-mode {
    background: #fff3cd;
    border-color: #ffc107;
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.2);
}

.conversion-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.conversion-arrow {
    color: #6c757d;
    font-weight: bold;
}

.conversion-rate {
    color: #6c757d;
    font-size: 12px;
    margin-bottom: 8px;
}

.conversion-controls {
    text-align: right;
}

.reset-exchange-btn {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.reset-exchange-btn:hover {
    background: #138496;
}

.manual-edit-indicator {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* =================================
   过渡和动画增强
   ================================= */
* {
    transition: color var(--transition-fast),
        background-color var(--transition-fast),
        border-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

/* 禁用拖拽时的过渡 */
.resizing * {
    transition: none !important;
}

/* =================================
   可访问性增强
   ================================= */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-primary: #000000;
        --text-secondary: #333333;
    }
}

/* =================================
   历史订单面板样式
   ================================= */
/* 历史订单面板基础样式 */
.history-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--overlay-backdrop);
    z-index: var(--z-modal);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.history-panel:not(.hidden) {
    display: flex !important;
}

.history-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-backdrop);
    z-index: 1;
}

.history-content {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    width: 90vw;
    max-height: 90vh;
    background: var(--bg-tertiary);
    -webkit-backdrop-filter: var(--blur-glass);
    backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 历史订单面板移动端优化 */
@media (max-width: 768px) {
    .history-content {
        width: 95vw;
        max-height: 95vh;
        margin: 0;
    }

    .history-panel {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .history-content {
        width: 98vw;
        max-height: 98vh;
        border-radius: 12px;
    }

    .history-panel {
        padding: 4px;
    }
}

/* 历史订单子元素样式 */
.history-header {
    background: var(--brand-gradient);
    color: var(--color-white);
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.history-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.history-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.history-search {
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.search-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.search-group label {
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.search-group input {
    padding: var(--spacing-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.search-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
}

.history-stats {
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--spacing-md);
}

.stat-item {
    text-align: center;
    padding: var(--spacing-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.stat-label {
    display: block;
    font-size: var(--font-xs);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.stat-value {
    display: block;
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--color-primary);
}

.history-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

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

.list-count {
    font-size: var(--font-sm);
    color: var(--text-secondary);
}

.list-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.empty-text {
    font-size: var(--font-base);
    opacity: 0.7;
}

.history-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.history-item:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.history-item-header {
    background: var(--bg-secondary);
    padding: var(--spacing-sm) var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-sm);
}

.history-item-content {
    padding: var(--spacing-md);
}

.history-item-content p {
    margin: 0 0 var(--spacing-xs) 0;
    font-size: var(--font-sm);
    line-height: 1.4;
}

/* 流式布局样式 */
.history-item-content.flow-layout {
    padding: var(--spacing-md);
    line-height: 1.8;
    font-size: var(--font-sm);
    color: var(--text-primary);
}

.history-item-content.flow-layout .field-item {
    display: inline;
    margin-right: var(--spacing-xs);
    white-space: nowrap;
}

.history-item-content.flow-layout .field-item:not(:last-child)::after {
    content: " • ";
    color: var(--text-secondary);
    margin-left: var(--spacing-xs);
    margin-right: var(--spacing-xs);
    font-weight: normal;
}

.history-item-content.flow-layout .field-label {
    font-weight: 600;
    color: var(--text-primary);
}

.history-item-content.flow-layout .field-value {
    color: var(--text-secondary);
    font-weight: normal;
}

/* 错误信息在流式布局中的特殊处理 */
.history-item-content.flow-layout p {
    margin: var(--spacing-sm) 0 0 0;
    display: block;
    font-size: var(--font-sm);
    line-height: 1.4;
}

/* 历史订单移动端子元素优化 */
@media (max-width: 768px) {
    .history-header {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .history-header h3 {
        font-size: 1rem;
    }

    .search-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-sm);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }

    .list-header {
        padding: var(--spacing-sm) var(--spacing-md);
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-xs);
    }

    .history-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-xs);
    }
}

@media (max-width: 480px) {

    .history-search,
    .history-stats,
    .list-container {
        padding: var(--spacing-sm);
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .search-actions {
        justify-content: stretch;
    }

    .search-actions .btn {
        flex: 1;
    }
}

/* 打印样式 */
@media print {
    * {
        background: var(--color-white) !important;
        color: var(--color-gray-900) !important;
        box-shadow: none !important;
    }

    .no-print {
        display: none !important;
    }

    .btn,
    .header-controls,
    .status-bar {
        display: none !important;
    }
}

/* ==========================================================================
   Voice Recording Overlay
   ========================================================================== */
.voice-recording-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    opacity: 1;
    transition: opacity 0.3s ease;
}

.voice-recording-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.recording-content {
    background: var(--surface-color, #ffffff);
    padding: 30px 50px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    min-width: 250px;
}

.dark-mode .recording-content {
    background: #1e1e1e;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.recording-visualizer {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 40px;
    gap: 4px;
    margin-bottom: 10px;
}

.wave-bar {
    width: 6px;
    background: var(--primary-color, #4f46e5);
    border-radius: 3px;
    animation: wave 1s infinite ease-in-out;
}

.wave-bar:nth-child(1) {
    animation-delay: 0.0s;
    height: 40%;
}

.wave-bar:nth-child(2) {
    animation-delay: 0.1s;
    height: 50%;
}

.wave-bar:nth-child(3) {
    animation-delay: 0.2s;
    height: 70%;
}

.wave-bar:nth-child(4) {
    animation-delay: 0.3s;
    height: 100%;
}

.wave-bar:nth-child(5) {
    animation-delay: 0.4s;
    height: 70%;
}

.wave-bar:nth-child(6) {
    animation-delay: 0.5s;
    height: 50%;
}

.wave-bar:nth-child(7) {
    animation-delay: 0.6s;
    height: 40%;
}

.wave-bar:nth-child(8) {
    animation-delay: 0.7s;
    height: 30%;
}

.wave-bar:nth-child(9) {
    animation-delay: 0.8s;
    height: 20%;
}

@keyframes wave {

    0%,
    100% {
        height: 20%;
    }

    50% {
        height: 100%;
    }
}

.recording-status {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
}

.dark-mode .recording-status {
    color: #f3f4f6;
}

.recording-timer {
    font-family: monospace;
    font-size: 1.1rem;
    color: var(--text-secondary, #6b7280);
}

.recording-instruction {
    font-size: 0.9rem;
    color: var(--text-secondary, #9ca3af);
    margin-top: 5px;
}

.btn-stop-recording {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #ef4444;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    margin-top: 10px;
}

.btn-stop-recording:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.btn-stop-recording:active {
    transform: scale(0.95);
}

.stop-icon-square {
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 4px;
}

/* 长按时的 UI 变化 */
.btn-upload-entry.active-recording {
    transform: scale(1.1);
    background: #fee2e2;
    border-color: #ef4444;
}

.dark-mode .btn-upload-entry.active-recording {
    background: #450a0a;
}

/* =================================
   自动计算价格移动端优化
   ================================= */
@media (max-width: 768px) {

    .auto-price-result,
    #autoPriceResult {
        font-size: 11px !important;
        line-height: 1.4;
        margin-top: 5px;
        padding: 4px;
    }

    .auto-price-container .btn {
        font-size: 11px !important;
        padding: 4px 8px !important;
        height: auto !important;
        min-height: 28px !important;
    }
}
/* =================================
   Order Input Optimizations (New)
   ================================= */
.textarea-wrapper {
    position: relative;
}

/* Status Indicator */
.input-status-indicator {
    position: absolute;
    bottom: 8px;
    right: 60px; /* Left of char counter */
    width: 8px;
    height: 8px;
    z-index: 10;
}
.status-dot {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #28a745; 
    box-shadow: 0 0 4px rgba(40, 167, 69, 0.5);
    animation: pulse-dot 2s infinite;
}
.input-status-indicator.hidden {
    display: none;
}
@keyframes pulse-dot {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* Clear Button */
.clear-input-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: rgba(0,0,0,0.05);
    color: #999;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}
.clear-input-btn:hover {
    background: rgba(0,0,0,0.15);
    color: #333;
}
.clear-input-btn.hidden {
    display: none;
}

/* Smart Chips */
.smart-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 8px;
}
.smart-chip {
    background: #f0f2f5;
    border: 1px solid #e1e4e8;
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 12px;
    color: #586069;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}
.smart-chip:hover {
    background: #e1e4e8;
    border-color: #d1d5da;
    color: #24292e;
}

/* Analysis Tags */
.analysis-result-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
    min-height: 0;
    margin-bottom: 8px;
}
.analysis-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #e6f7ff;
    border: 1px solid #91d5ff;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    color: #0050b3;
}
.analysis-tag .tag-label {
    font-weight: 600;
    opacity: 0.8;
}


/* =================================
   Multimodal Entry Optimizations
   ================================= */

/* Drag & Drop Overlay */
.drag-drop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--color-primary, #007bff);
    border-radius: 8px;
    backdrop-filter: blur(2px);
    transition: all 0.2s ease;
}
.drag-drop-overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}
.drop-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--color-primary, #007bff);
    font-weight: 500;
}

/* Inline Media Preview */
.inline-media-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
    margin-bottom: 8px;
    padding: 0 4px;
}
.inline-media-preview.hidden {
    display: none;
}
.media-preview-item {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #ddd;
    background: #f8f9fa;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.media-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.media-preview-item .file-icon-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: #666;
    background: #e9ecef;
}
.media-preview-item .remove-media-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    font-size: 10px;
    line-height: 1;
}
.media-preview-item .remove-media-btn:hover {
    background: red;
}

/* Media Loading Skeleton */
.media-loading-skeleton {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Media Status Badge */
.media-status-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid white;
    z-index: 2;
}
.media-status-badge.status-loading {
    background: #ffc107;
    animation: pulse-status 1s infinite;
}
.media-status-badge.status-success {
    background: #28a745;
}
.media-status-badge.status-error {
    background: #dc3545;
}
@keyframes pulse-status {
    0% { transform: scale(0.8); opacity: 0.8; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.8); opacity: 0.8; }
}

/* Recording Pulse Animation */
.recording-pulse.pulsing,
.recording-status.pulsing {
    animation: voice-pulse 1.5s infinite;
}
@keyframes voice-pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

