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

:root {
  --teal: #00897b;
  --teal-dark: #00695c;
  --teal-light: #e0f2f1;
  --teal-glow: rgba(0, 137, 123, 0.18);
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface2: #f9fbfa;
  --border: #d8e5e3;
  --text: #1a2e2b;
  --text-muted: #5e7b76;
  --text-light: #8fa8a3;
  --red: #e53935;
  --red-light: #ffebee;
  --green: #2e7d32;
  --green-light: #e8f5e9;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 2px 16px rgba(0,0,0,0.07);
  --shadow-md: 0 4px 32px rgba(0,0,0,0.10);
  --font: 'Plus Jakarta Sans', sans-serif;
  --mono: 'DM Mono', monospace;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.layout {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 270px;
  min-width: 270px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 20px 24px;
  gap: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.logo-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  color: white;
  box-shadow: 0 4px 14px var(--teal-glow);
  flex-shrink: 0;
}

.logo-title { font-size: 1.2rem; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.logo-sub   { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; }
.logo-org   { font-size: 0.72rem; color: var(--teal); font-weight: 600; margin-bottom: 28px; padding-left: 56px; }

.sidebar-section { margin-bottom: 24px; }
.sidebar-label { display: block; font-size: 0.72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; }

.radio-group { display: flex; flex-direction: column; gap: 6px; }

.radio-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s;
  background: var(--surface2);
}
.radio-card input { display: none; }
.radio-card:hover { border-color: var(--teal); color: var(--text); }
.radio-card.active { border-color: var(--teal); background: var(--teal-light); color: var(--teal-dark); font-weight: 700; }
.radio-icon { font-size: 1rem; }

.select-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--text);
  background: var(--surface2);
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
.select-input:focus { border-color: var(--teal); }

.sidebar-tip {
  margin-top: auto;
  padding: 14px;
  background: var(--teal-light);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--teal);
}
.tip-title { font-size: 0.78rem; font-weight: 700; color: var(--teal-dark); margin-bottom: 6px; }
.sidebar-tip p { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }

.sidebar-footer { font-size: 0.7rem; color: var(--text-light); text-align: center; margin-top: 16px; }

/* ── MAIN ── */
.main { flex: 1; padding: 36px 40px; max-width: 960px; }

.main-header { margin-bottom: 28px; }
.main-title { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.03em; color: var(--text); }
.main-sub { font-size: 0.88rem; color: var(--text-muted); margin-top: 4px; }

/* ── CARDS ── */
.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card-head { display: flex; align-items: center; gap: 10px; }
.card-icon { font-size: 1.1rem; }
.card-title { font-size: 1rem; font-weight: 700; color: var(--text); }

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--surface2);
  flex: 1;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--teal); background: var(--teal-light); }
.drop-icon { font-size: 2rem; margin-bottom: 8px; }
.drop-text { font-size: 0.88rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.drop-sub { font-size: 0.75rem; color: var(--text-muted); }

.file-info {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--green-light);
  border: 1px solid #c8e6c9;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--green);
  font-weight: 600;
}

/* Textarea */
.text-area {
  flex: 1;
  min-height: 155px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text);
  background: var(--surface2);
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.6;
}
.text-area:focus { border-color: var(--teal); }
.char-count { font-size: 0.73rem; color: var(--text-light); text-align: right; }

/* Analyze Button */
.analyze-btn {
  width: 100%;
  padding: 16px 28px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: white;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: all 0.2s;
  box-shadow: 0 4px 20px var(--teal-glow);
  letter-spacing: -0.01em;
  margin-bottom: 20px;
}
.analyze-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 28px rgba(0,137,123,0.3); }
.analyze-btn:active { transform: translateY(0); }
.analyze-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-arrow { font-size: 1.1rem; }

/* Progress */
.progress-area { margin-bottom: 24px; }
.progress-bar-wrap { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin-bottom: 10px; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--teal), #26c6b0); border-radius: 99px; transition: width 0.4s ease; width: 0%; }
.progress-text { font-size: 0.82rem; color: var(--text-muted); font-weight: 500; }

/* Results */
.result-area { margin-top: 8px; }
.result-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; gap: 16px; }
.result-title { font-size: 1.2rem; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.result-meta { font-size: 0.82rem; color: var(--text-muted); margin-top: 3px; }

.download-btn {
  padding: 9px 18px;
  background: var(--surface);
  border: 1.5px solid var(--teal);
  color: var(--teal);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.download-btn:hover { background: var(--teal-light); }

.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }

.result-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.result-table thead tr { background: var(--text); color: white; }
.result-table th { padding: 12px 16px; text-align: left; font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
.result-table th:first-child { width: 44px; border-radius: var(--radius-sm) 0 0 0; }
.result-table th:last-child { border-radius: 0 var(--radius-sm) 0 0; }
.result-table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.15s; }
.result-table tbody tr:last-child { border-bottom: none; }
.result-table tbody tr:hover { background: var(--teal-light); }
.result-table td { padding: 13px 16px; vertical-align: top; }
.result-table td:first-child { color: var(--text-light); font-weight: 700; font-size: 0.78rem; }

.cell-wrong { font-family: var(--mono); color: var(--red); background: var(--red-light); padding: 3px 7px; border-radius: 5px; font-size: 0.8rem; display: inline-block; }
.cell-correct { font-family: var(--mono); color: var(--green); background: var(--green-light); padding: 3px 7px; border-radius: 5px; font-size: 0.8rem; display: inline-block; }
.cell-note { color: var(--text-muted); font-size: 0.81rem; line-height: 1.5; }

/* Empty & Error */
.empty-state { text-align: center; padding: 52px 20px; }
.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.2rem; font-weight: 800; color: var(--green); margin-bottom: 8px; }
.empty-state p { font-size: 0.85rem; color: var(--text-muted); }

.error-box {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: var(--red-light);
  border: 1px solid #ef9a9a;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--red);
  font-weight: 600;
  margin-top: 16px;
}
.error-icon { font-size: 1.1rem; }

.hidden { display: none !important; }

/* Responsive */
@media (max-width: 860px) {
  .sidebar { width: 230px; min-width: 230px; }
  .main { padding: 24px 20px; }
}
@media (max-width: 680px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; padding: 16px; gap: 12px; }
  .sidebar-footer, .sidebar-tip { display: none; }
  .input-grid { grid-template-columns: 1fr; }
  .main { padding: 16px; }
}
