/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Segoe UI", "Hiragino Sans", "Meiryo", sans-serif; background: #f4f6f9; color: #333; line-height: 1.6; }

/* === Login === */
.login-container {
  max-width: 380px; margin: 120px auto; padding: 40px;
  background: #fff; border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,.08);
  text-align: center;
}
.login-container h1 { font-size: 1.8rem; color: #2563eb; margin-bottom: 4px; }
.subtitle { color: #64748b; font-size: .9rem; margin-bottom: 28px; }

/* === Forms === */
.form-group { margin-bottom: 16px; text-align: left; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 4px; color: #475569; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1;
  border-radius: 8px; font-size: .95rem; transition: border .2s;
}
.form-group input:focus, .form-group select:focus { border-color: #2563eb; outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border: none; border-radius: 8px;
  font-size: .95rem; font-weight: 600; cursor: pointer; transition: all .2s;
}
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { background: #94a3b8; cursor: not-allowed; }
.btn-secondary { background: #e2e8f0; color: #475569; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-full { width: 100%; }

/* === Error === */
.error-message { color: #ef4444; font-size: .85rem; margin: 8px 0; }

/* === Header === */
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px; background: #fff; border-bottom: 1px solid #e2e8f0;
}
header h1 { font-size: 1.2rem; color: #2563eb; }
.header-right { display: flex; align-items: center; gap: 12px; }
#user-info { font-size: .85rem; color: #64748b; }

/* === Tabs === */
.tabs { display: flex; gap: 0; background: #fff; border-bottom: 2px solid #e2e8f0; padding: 0 24px; }
.tab {
  padding: 12px 24px; border: none; background: none;
  font-size: .95rem; font-weight: 600; color: #64748b; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .2s;
}
.tab:hover { color: #2563eb; }
.tab.active { color: #2563eb; border-bottom-color: #2563eb; }

/* === Panels === */
.panel { padding: 24px; max-width: 1100px; margin: 0 auto; }
.section-box {
  background: #fff; border-radius: 12px; padding: 24px;
  box-shadow: 0 1px 6px rgba(0,0,0,.04); margin-bottom: 20px;
}
.section-box h2 { font-size: 1.1rem; margin-bottom: 16px; color: #1e293b; }

/* === Upload === */
.upload-row { display: flex; gap: 16px; margin-bottom: 16px; }
.upload-area {
  flex: 1; border: 2px dashed #cbd5e1; border-radius: 10px;
  padding: 20px; text-align: center; cursor: pointer; transition: border .2s;
  margin-bottom: 16px;
}
.upload-area:hover { border-color: #2563eb; }
.upload-area p { font-weight: 600; color: #475569; margin-bottom: 8px; }
.upload-area input[type="file"] { margin-top: 8px; }
.file-count { font-size: .8rem; color: #94a3b8; }

/* === Progress === */
.progress-container { margin: 12px 0; }
.progress-bar { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: #2563eb; border-radius: 4px; transition: width .3s; width: 0%; }
#train-progress-text, #filter-progress-text { font-size: .8rem; color: #64748b; margin-top: 4px; display: block; }

/* === Tables === */
table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th { text-align: left; padding: 10px 12px; background: #f8fafc; color: #475569; font-size: .8rem; font-weight: 700; text-transform: uppercase; border-bottom: 2px solid #e2e8f0; }
td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; font-size: .9rem; }
tr:hover td { background: #f8fafc; }

/* === Badges === */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: .8rem; font-weight: 700; }
.badge-go { background: #dcfce7; color: #16a34a; }
.badge-nogo { background: #fee2e2; color: #dc2626; }
.badge-selected { background: #dbeafe; color: #2563eb; }

/* === Summary Cards === */
.summary-cards { display: flex; gap: 16px; margin-bottom: 20px; }
.card {
  flex: 1; background: #fff; border-radius: 12px; padding: 20px;
  text-align: center; box-shadow: 0 1px 6px rgba(0,0,0,.04);
}
.card-num { display: block; font-size: 2rem; font-weight: 700; }
.card-label { font-size: .85rem; color: #64748b; }
.card-go .card-num { color: #16a34a; }
.card-nogo .card-num { color: #dc2626; }

/* === Probability Bar === */
.prob-bar { display: inline-block; width: 80px; height: 6px; background: #e2e8f0; border-radius: 3px; vertical-align: middle; margin-right: 6px; }
.prob-fill { display: block; height: 100%; background: #2563eb; border-radius: 3px; }

/* === Radio in Table === */
table input[type="radio"] { cursor: pointer; }

/* === LLM Settings === */
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.btn-row { display: flex; gap: 12px; margin-top: 16px; }
.hint { font-size: .8rem; color: #64748b; }
.test-result {
  margin-top: 16px; padding: 12px 16px; border-radius: 8px; font-size: .9rem;
}
.test-result.success { background: #dcfce7; color: #16a34a; }
.test-result.failure { background: #fee2e2; color: #dc2626; }
.test-result.info { background: #dbeafe; color: #2563eb; }

/* === Help === */
.help-steps { padding-left: 20px; margin: 12px 0; }
.help-steps li { margin-bottom: 8px; line-height: 1.7; }
.help-steps ul { margin-top: 6px; padding-left: 20px; }
.help-list { padding-left: 20px; margin: 12px 0; }
.help-list li { margin-bottom: 6px; line-height: 1.6; }
.help-note {
  margin: 12px 0; padding: 12px 16px; border-radius: 8px;
  background: #fffbeb; border-left: 4px solid #f59e0b; font-size: .9rem; color: #92400e;
}
.help-table { margin: 12px 0; }
.help-table th { background: #f1f5f9; font-size: .85rem; }
.help-table td { font-size: .9rem; }
#panel-help h3 { font-size: 1rem; margin: 16px 0 8px; color: #334155; }
#panel-help p { margin-bottom: 8px; line-height: 1.7; }
#panel-help code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: .85rem; }

/* === Modal === */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal {
  background: #fff; border-radius: 12px; padding: 24px;
  width: 90%; max-width: 700px; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h3 { font-size: 1.1rem; color: #1e293b; }

/* === Feature Importance Chart === */
.importance-chart { display: flex; flex-direction: column; gap: 6px; }
.imp-row { display: flex; align-items: center; gap: 10px; font-size: .85rem; }
.imp-label { width: 200px; text-align: right; color: #475569; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-bar-bg { flex: 1; height: 18px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.imp-bar { height: 100%; background: #2563eb; border-radius: 4px; transition: width .4s; min-width: 2px; }
.imp-val { width: 50px; font-size: .8rem; color: #64748b; }

/* === Utility === */
[hidden] { display: none !important; }
