/* Focus Noise Calibration Analyzer - Glass Style (Cloud Disk theme) */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Inter', 'Helvetica Neue', sans-serif;
    background: #faf5f0;
    color: #2d2a3d;
    min-height: 100vh;
    position: relative;
}

/* Fluid Background */
.fluid-bg {
    position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.fluid-bg .blob {
    position: absolute; border-radius: 50%; filter: url(#fluidBlob);
    opacity: 0.5; animation: blobDrift 24s ease-in-out infinite; mix-blend-mode: multiply;
}
.fluid-bg .blob:nth-child(1) {
    width: 500px; height: 500px;
    background: radial-gradient(circle at 40% 30%, #ddd6fe, #c4b5fd, #a78bfa);
    top: -15%; left: -10%; animation-delay: 0s; animation-duration: 22s; opacity: 0.35;
}
.fluid-bg .blob:nth-child(2) {
    width: 450px; height: 450px;
    background: radial-gradient(circle at 60% 40%, #fce7f3, #fbcfe8, #f9a8d4);
    bottom: -15%; right: -10%; animation-delay: -6s; animation-duration: 26s; opacity: 0.3;
}
.fluid-bg .blob:nth-child(3) {
    width: 350px; height: 350px;
    background: radial-gradient(circle at 50% 50%, #fef3c7, #fdba74, #fb923c);
    top: 50%; left: 50%; margin-left: -175px; margin-top: -175px;
    animation-delay: -12s; animation-duration: 28s; opacity: 0.2;
}
.fluid-bg .blob:nth-child(4) {
    width: 320px; height: 320px;
    background: radial-gradient(circle at 30% 60%, #d1fae5, #6ee7b7, #34d399);
    top: 10%; right: 0%; animation-delay: -18s; animation-duration: 20s; opacity: 0.3;
}
.fluid-bg .blob:nth-child(5) {
    width: 260px; height: 260px;
    background: radial-gradient(circle at 70% 50%, #e0f2fe, #67e8f9, #22d3ee);
    bottom: 20%; left: 0%; animation-delay: -9s; animation-duration: 30s; opacity: 0.25;
}
@keyframes blobDrift {
    0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
    20% { transform: translate(70px, -50px) scale(1.06) rotate(3deg); }
    40% { transform: translate(-40px, 70px) scale(0.94) rotate(-2deg); }
    60% { transform: translate(50px, 30px) scale(1.04) rotate(4deg); }
    80% { transform: translate(-60px, -40px) scale(0.96) rotate(-3deg); }
}

/* Background noise */
.noise-overlay {
    position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
}

/* Container */
.container { position: relative; z-index: 1; max-width: 1280px; margin: 0 auto; padding: 20px 16px; }

/* Header - Glass */
header {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 18px;
    padding: 20px 24px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(120,80,180,0.06);
}
header h1 { font-size: 24px; font-weight: 800; color: #2d2a3d; letter-spacing: 0.3px; }
header h1 span { color: #7c3aed; }
header .subtitle { font-size: 14px; color: #8a86a0; }

/* Cards / Panels - Glass */
.card, .project-info, .analysis-section, .upload-bar, .upload-queue, .report-content {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(120,80,180,0.06);
    animation: panelIn 0.3s ease-out;
}
.step-card {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 18px;
    padding: 20px 20px 20px 24px;
    position: relative;
    animation: panelIn 0.3s ease-out;
    transition: all 0.25s;
}
.step-card:hover { background: rgba(255,255,255,0.3); }

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

/* Buttons - Glass */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 20px; border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px; font-size: 14px; font-weight: 500; cursor: pointer;
    transition: all 0.25s; text-decoration: none;
    background: rgba(255,255,255,0.2); color: #2d2a3d;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    line-height: 1.4;
}
.btn:hover { background: rgba(255,255,255,0.35); border-color: rgba(255,255,255,0.4); }
.btn-primary { background: rgba(167,139,250,0.2); border-color: rgba(167,139,250,0.3); color: #7c3aed; }
.btn-primary:hover { background: rgba(167,139,250,0.3); }
.btn-success { background: rgba(110,231,183,0.2); border-color: rgba(110,231,183,0.3); color: #059669; }
.btn-success:hover { background: rgba(110,231,183,0.3); }
.btn-danger { background: rgba(244,63,94,0.15); border-color: rgba(244,63,94,0.2); color: #e11d48; }
.btn-danger:hover { background: rgba(244,63,94,0.25); }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 10px 24px; font-size: 16px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Info Grid */
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.info-item { display: flex; flex-direction: column; }
.info-item .label { font-size: 12px; color: #8a86a0; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 2px; }
.info-item .value { font-size: 15px; font-weight: 500; color: #2d2a3d; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.3; backdrop-filter: blur(4px); }
.badge-success { background: rgba(110,231,183,0.2); color: #059669; }
.badge-warning { background: rgba(251,191,36,0.2); color: #d97706; }
.badge-error { background: rgba(244,63,94,0.15); color: #e11d48; }
.badge-info { background: rgba(103,232,249,0.2); color: #0891b2; }
.badge-neutral { background: rgba(200,200,210,0.2); color: #8a86a0; }
.status-created { background: rgba(200,200,210,0.2); color: #8a86a0; }
.status-analyzing { background: rgba(251,191,36,0.2); color: #d97706; }
.status-completed { background: rgba(110,231,183,0.2); color: #059669; }

/* Upload Bar */
.upload-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.upload-bar .upload-title { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; color: #2d2a3d; }
.upload-bar .upload-title span { color: #7c3aed; }
.upload-bar .upload-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Upload Queue */
.upload-queue { display: none; border: 2px dashed rgba(167,139,250,0.3); }
.upload-queue.active { display: block; }
.upload-queue-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-weight: 600; color: #2d2a3d; }
.upload-queue-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; margin-bottom: 6px; background: rgba(255,255,255,0.15); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.15); transition: all 0.2s; }
.upload-queue-item:hover { background: rgba(167,139,250,0.1); }
.upload-queue-item .file-icon { font-size: 18px; }
.upload-queue-item .file-name { flex: 1; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #2d2a3d; }
.upload-queue-item select { font-size: 12px; padding: 3px 6px; border: 1px solid rgba(255,255,255,0.3); border-radius: 6px; background: rgba(255,255,255,0.15); cursor: pointer; color: #2d2a3d; backdrop-filter: blur(4px); }
.upload-queue-item .remove-btn { cursor: pointer; color: #e11d48; background: none; border: none; font-size: 16px; padding: 2px; line-height: 1; }
.upload-queue-item .status-icon { font-size: 14px; width: 18px; text-align: center; }

/* Steps Grid */
.steps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-bottom: 24px; }
.step-card .step-number { position: absolute; top: -8px; left: -8px; width: 28px; height: 28px; background: rgba(124,58,237,0.7); backdrop-filter: blur(8px); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; box-shadow: 0 4px 8px rgba(124,58,237,0.2); }
.step-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; color: #2d2a3d; padding-left: 20px; }
.step-card .step-desc { font-size: 13px; color: #8a86a0; margin-bottom: 8px; }
.step-card .step-files-needed { font-size: 12px; color: #8a86a0; margin-bottom: 10px; }
.step-card .step-no-upload { font-size: 13px; color: #8a86a0; font-style: italic; padding: 8px 0; }
.step-card .complete { position: absolute; top: 8px; right: 8px; background: rgba(110,231,183,0.2); color: #059669; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; backdrop-filter: blur(4px); }
.step-files-list { margin: 8px 0; }
.step-card .file-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.15); margin-bottom: 4px; font-size: 13px; }
.step-card .file-item .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #2d2a3d; }
.step-card .file-item .file-type { font-size: 11px; color: #8a86a0; background: rgba(255,255,255,0.1); padding: 1px 6px; border-radius: 6px; }

/* Analysis Section */
.analysis-section h2 { font-size: 18px; font-weight: 700; margin-bottom: 16px; color: #2d2a3d; display: flex; align-items: center; gap: 8px; }
.symptom-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.symptom-chip { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; border: 1px solid rgba(255,255,255,0.3); cursor: pointer; transition: all 0.2s; user-select: none; background: rgba(255,255,255,0.15); color: #8a86a0; backdrop-filter: blur(4px); }
.symptom-chip:hover { border-color: rgba(167,139,250,0.4); color: #7c3aed; background: rgba(167,139,250,0.1); }
.symptom-chip.selected { background: rgba(167,139,250,0.15); border-color: rgba(167,139,250,0.4); color: #7c3aed; font-weight: 600; }
.symptom-chip input { display: none; }

/* Results */
#results { margin-top: 24px; }
.finding-item { padding: 12px 16px; margin-bottom: 8px; border-radius: 10px; border-left: 4px solid; font-size: 13px; backdrop-filter: blur(8px); }
.finding-critical { background: rgba(244,63,94,0.1); border-color: #e11d48; color: #2d2a3d; }
.finding-error { background: rgba(248,113,113,0.1); border-color: #f87171; color: #2d2a3d; }
.finding-warning { background: rgba(251,191,36,0.12); border-color: #f59e0b; color: #2d2a3d; }
.finding-info { background: rgba(103,232,249,0.1); border-color: #06b6d4; color: #2d2a3d; }

/* Loading */
#loading { display: none; text-align: center; padding: 32px; }
.spinner { width: 40px; height: 40px; border: 3px solid rgba(167,139,250,0.2); border-top-color: #7c3aed; border-radius: 50%; animation: spin 0.7s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Progress bar */
.progress-bar { width: 100%; height: 4px; background: rgba(200,200,210,0.2); border-radius: 2px; overflow: hidden; margin: 8px 0; }
.progress-bar .progress-fill { height: 100%; background: linear-gradient(90deg, #a78bfa, #7c3aed); border-radius: 2px; transition: width 0.3s; width: 0%; }

/* Table */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.15); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #8a86a0; font-weight: 600; background: rgba(255,255,255,0.08); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(167,139,250,0.06); }

/* Empty state */
.empty-state { text-align: center; padding: 48px 16px; color: #8a86a0; }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: #2d2a3d; }

/* Report */
.report-content { line-height: 1.7; }
.report-content h1 { font-size: 24px; margin: 24px 0 8px; color: #2d2a3d; }
.report-content h2 { font-size: 18px; margin: 16px 0 8px; padding-bottom: 4px; border-bottom: 2px solid rgba(167,139,250,0.2); }
.report-content h3 { font-size: 16px; margin: 12px 0 8px; color: #7c3aed; }
.report-content ul, .report-content ol { padding-left: 24px; margin: 8px 0; }
.report-content li { margin: 4px 0; }
.report-content strong { color: #2d2a3d; }

/* Toast */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 10px 20px; border-radius: 12px; color: #fff; font-size: 14px; font-weight: 500; backdrop-filter: blur(12px); box-shadow: 0 8px 32px rgba(120,80,180,0.12); z-index: 1000; transform: translateY(100px); opacity: 0; transition: all 0.3s; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast-success { background: rgba(5,150,105,0.85); }
.toast-error { background: rgba(225,29,72,0.85); }
.toast-info { background: rgba(124,58,237,0.85); }

/* Form elements - Glass */
input[type="text"], input[type="password"], input[type="email"], textarea, select {
    width: 100%; padding: 10px 16px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border-radius: 10px; font-size: 14px; transition: all 0.2s; outline: none; color: #2d2a3d;
}
input:focus, textarea:focus, select:focus { border-color: rgba(167,139,250,0.6); background: rgba(255,255,255,0.25); box-shadow: 0 0 0 3px rgba(167,139,250,0.1); }
label { display: block; font-size: 13px; color: #8a86a0; margin-bottom: 6px; font-weight: 500; }

/* Responsive */
@media (max-width: 768px) {
    .container { padding: 16px 12px; }
    header { flex-direction: column; align-items: flex-start; padding: 16px 18px; }
    header h1 { font-size: 20px; }
    .steps-grid { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr 1fr; }
    .upload-bar { flex-direction: column; align-items: stretch; }
    .symptom-grid { gap: 6px; }
    table { font-size: 12px; }
    th, td { padding: 8px; }
}

/* Misc */
.btn-icon { background: none; border: none; font-size: 13px; cursor: pointer; padding: 4px 8px; border-radius: 8px; transition: background 0.2s; }
.btn-icon:hover { background: rgba(167,139,250,0.15); color: #7c3aed; }

.chart-tab { padding: 4px 10px; font-size: 12px; border: 1px solid rgba(255,255,255,0.3); border-radius: 6px; background: rgba(255,255,255,0.15); color: #8a86a0; cursor: pointer; transition: all 0.2s; }
.chart-tab:hover { background: rgba(255,255,255,0.25); }
.chart-tab.active { background: rgba(167,139,250,0.2); color: #7c3aed; border-color: rgba(167,139,250,0.4); }

.file-raw-content { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; font-size: 10px; line-height: 1.3; color: #5a5670; background: rgba(255,255,255,0.1); padding: 8px; border-radius: 8px; }
.file-raw-content::-webkit-scrollbar { height: 4px; }
.file-raw-content::-webkit-scrollbar-thumb { background: rgba(200,200,210,0.3); border-radius: 2px; }

.report-chart { margin: 8px 0; }
.report-chart .js-plotly-plot .plot-container { border: 1px solid rgba(255,255,255,0.2); border-radius: 8px; }
