:root {
    --bg-color: #f3f4f6;
    --surface-color: rgba(255, 255, 255, 0.8);
    --border-color: rgba(255, 255, 255, 0.4);
    --text-main: #111827;
    --text-sec: #6b7280;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #f0f4ff 0%, #e5e9fa 100%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.app-container {
    width: 100%;
    max-width: 1200px;
    min-height: 90vh;
    background: var(--surface-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.glass-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.5);
}
.logo { display: flex; align-items: center; gap: 0.75rem; color: var(--primary); }
.logo h1 {
    font-size: 1.25rem; font-weight: 700; color: var(--text-main);
    display: flex; align-items: center; gap: 0.5rem;
}
.badge {
    background: linear-gradient(135deg, var(--primary), #818cf8);
    color: white; font-size: 0.7rem; padding: 0.2rem 0.5rem;
    border-radius: 999px; font-weight: 600;
}
nav { display: flex; gap: 1rem; background: rgba(0,0,0,0.05); padding: 0.25rem; border-radius: 999px; }
.nav-btn {
    appearance: none; border: none; background: transparent;
    padding: 0.5rem 1.25rem; border-radius: 999px;
    font-size: 0.9rem; font-weight: 500; color: var(--text-sec); cursor: pointer;
    transition: all 0.2s ease;
}
.nav-btn:hover { color: var(--text-main); }
.nav-btn.active { background: white; color: var(--primary); box-shadow: var(--shadow-sm); }

/* Main Content */
.content-area { flex: 1; padding: 2rem; overflow-y: auto; }
.module-section { display: flex; flex-direction: column; gap: 1.5rem; animation: fadeIn 0.4s ease-out; }
.module-section.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.module-header h2 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.5rem; }
.module-header p { color: var(--text-sec); }

/* Glass Card */
.glass-card {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}
.glass-card h3 { font-size: 1.1rem; color: var(--text-main); }

/* File Input Row (legacy-style) */
.file-input-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.file-input-row label {
    font-size: 0.9rem;
    font-weight: 500;
    min-width: 210px;
    color: var(--text-main);
}
.file-input-group {
    flex: 1;
    display: flex;
    gap: 0.5rem;
}
.file-path-input {
    flex: 1;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: var(--radius-md);
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    color: var(--text-main);
    cursor: pointer;
}
.file-path-input:focus { outline: none; border-color: var(--primary); }
.btn-browse {
    appearance: none;
    border: 1px solid var(--primary);
    background: white;
    color: var(--primary);
    border-radius: var(--radius-md);
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-browse:hover { background: var(--primary); color: white; }
.btn-browse-folder {
    border-color: #0d9488;
    color: #0d9488;
}
.btn-browse-folder:hover { background: #0d9488; color: white; }
.btn-browse-clear {
    border-color: #9ca3af;
    color: #9ca3af;
}
.btn-browse-clear:hover { background: #9ca3af; color: white; }
.path-hint {
    font-size: 0.78rem;
    color: var(--text-sec);
    margin-top: 0.25rem;
    margin-left: 218px;
    padding-bottom: 0.25rem;
}
.file-path-input[type="text"] {
    cursor: text;
}

/* Production Button Grid */
.prod-btn-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}
.prod-btn {
    appearance: none;
    border: 2px solid transparent;
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.25rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    box-shadow: var(--shadow-sm);
}
.prod-btn:hover {
    border-color: var(--btn-color, var(--primary));
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}
.prod-btn:active { transform: translateY(0); }
.prod-btn.running {
    opacity: 0.6;
    pointer-events: none;
}
.prod-btn-icon { font-size: 1.6rem; margin-bottom: 0.25rem; }
.prod-btn-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}
.prod-btn-desc {
    font-size: 0.78rem;
    color: var(--text-sec);
    line-height: 1.3;
}

/* Results / Progress */
.results-panel {
    background: #1f2937;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    color: #e5e7eb;
}
.progress-bar-container {
    height: 8px; background: rgba(255,255,255,0.1);
    border-radius: 999px; overflow: hidden; margin-bottom: 0.75rem;
}
.progress-bar {
    height: 100%; background: linear-gradient(90deg, var(--primary), #818cf8);
    border-radius: 999px; transition: width 0.3s ease;
}
.status-text { font-size: 0.9rem; margin-bottom: 1rem; }
.log-output {
    background: #111827;
    border-radius: var(--radius-md);
    padding: 1rem;
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
    min-height: 120px;
    max-height: 300px;
    overflow-y: auto;
    color: #a78bfa;
    line-height: 1.6;
}

/* ============================== */
/* MDB 扫描结果面板               */
/* ============================== */
.mdb-scan-panel {
    border: 1px solid rgba(79, 70, 229, 0.15);
    transition: all 0.3s ease;
}
.mdb-scan-panel.scanning {
    border-color: rgba(79, 70, 229, 0.4);
    animation: scanPulse 1.5s ease-in-out infinite;
}
@keyframes scanPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.1); }
    50% { box-shadow: 0 0 20px 4px rgba(79, 70, 229, 0.15); }
}

.mdb-scan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.mdb-scan-header h3 {
    display: flex;
    align-items: center;
    color: var(--primary);
}
.mdb-scan-count {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.2rem 0.75rem;
    border-radius: 999px;
}
.count-success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}
.count-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}
.count-error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.mdb-scan-status {
    margin-bottom: 0.75rem;
    font-size: 0.88rem;
}
.scan-loading {
    color: var(--primary);
    animation: blink 1s ease-in-out infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.scan-success { color: var(--success); }
.scan-warning { color: var(--warning); }
.scan-error   { color: var(--danger); }

/* MDB 文件卡片列表 */
.mdb-scan-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@keyframes mdbCardSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mdb-file-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    cursor: default;
    animation: mdbCardSlideIn 0.3s ease-out both;
}
.mdb-file-card:hover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.03);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.08);
}
.mdb-file-card.selected {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.06);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.mdb-file-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(129, 140, 248, 0.1));
    border-radius: 0.5rem;
    color: var(--primary);
}

.mdb-file-info {
    flex: 1;
    min-width: 0;
}
.mdb-file-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mdb-file-path {
    font-size: 0.78rem;
    color: var(--text-sec);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.1rem;
}

.mdb-file-meta {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
}
.mdb-file-size {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
}
.mdb-file-date {
    font-size: 0.72rem;
    color: var(--text-sec);
}

.mdb-file-select {
    flex-shrink: 0;
    appearance: none;
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--primary);
    border-radius: var(--radius-md);
    padding: 0.4rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.mdb-file-select:hover {
    background: var(--primary);
    color: white;
}
.mdb-file-card.selected .mdb-file-select {
    background: var(--primary);
    color: white;
}

/* ============================== */
/* 文件浏览器模态框 (MacOS 风格)    */
/* ============================== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    margin: 5% auto;
    width: 80%;
    max-width: 800px;
    height: 70vh;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.9) !important;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding-bottom: 1rem;
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-sec);
}

.browser-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
}

.nav-icon-btn {
    appearance: none;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
}

.current-path-display {
    flex: 1;
    background: rgba(0,0,0,0.03);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-sec);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.browser-body {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background: white;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.file-list-item {
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background 0.2s;
}

.file-list-item:hover {
    background: rgba(79, 70, 229, 0.05);
}

.file-list-item.selected {
    background: rgba(79, 70, 229, 0.1);
}

.item-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
}

.item-name {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-main);
}

.item-meta {
    font-size: 0.75rem;
    color: var(--text-sec);
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.selection-info {
    font-size: 0.85rem;
    color: var(--text-sec);
}

#current-selection-name {
    font-weight: 600;
    color: var(--primary);
}

.footer-btns {
    display: flex;
    gap: 0.75rem;
}

.btn-primary {
    background: var(--primary) !important;
    color: white !important;
}

.btn-icon {
    display: inline-block;
    vertical-align: middle;
}


