/* Assignment 2 — Confusion Matrix Evaluation */
@import url('https://fonts.googleapis.com/css2?family=Satoshi:wght@400;500;700;900&family=IBM+Plex+Mono:wght@400;600&display=swap');

:root {
  --bg: #fafaf7;
  --surface: #ffffff;
  --surface2: #f4f3ee;
  --border: rgba(0,0,0,0.09);
  --text: #18181b;
  --text2: #71717a;
  --accent: #6366f1;
  --accent2: #8b5cf6;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 14px;
  --font: 'Satoshi', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; }

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.hdr-left { display: flex; align-items: center; gap: 12px; }
.hdr-icon { font-size: 26px; }
header h1 { font-size: 18px; font-weight: 900; }
header p { font-size: 12px; color: var(--text2); }
.hdr-status {
  font-size: 12px; padding: 5px 12px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 20px; font-family: var(--mono);
}

.page-grid {
  display: grid; grid-template-columns: 240px 1fr 220px;
  gap: 0; min-height: calc(100vh - 65px);
}
.col { padding: 16px; overflow-y: auto; }
.col-eval { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  margin-bottom: 12px;
}
.panel-title {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--text2); margin-bottom: 12px;
}

/* CLASS LIST (training data) */
.class-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.class-item {
  border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden;
}
.class-item-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px;
  font-size: 13px; font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.class-color-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.class-item-body { padding: 8px 10px; }
.class-upload-lbl {
  display: block; background: var(--surface2);
  border: 1px dashed var(--border); border-radius: 6px;
  padding: 6px; text-align: center; font-size: 11px;
  cursor: pointer; margin-bottom: 6px; transition: all 0.2s;
}
.class-upload-lbl:hover { background: #f0effe; border-color: var(--accent); }
.class-thumbs { display: flex; gap: 4px; flex-wrap: wrap; }
.class-thumb-img { width: 40px; height: 40px; border-radius: 5px; object-fit: cover; }

/* BUTTONS */
.btn-primary {
  width: 100%; padding: 10px;
  background: var(--accent);
  color: #fff; border: none; border-radius: 9px;
  font-family: var(--font); font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
}
.btn-primary:hover { background: #4f46e5; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-secondary {
  width: 100%; padding: 9px;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); border-radius: 9px;
  font-family: var(--font); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
  margin-top: 8px;
}
.btn-secondary:hover { background: #f0effe; border-color: var(--accent); color: var(--accent); }
.btn-sm-full { margin-top: 0; margin-bottom: 10px; }

/* MINI PROGRESS */
.mini-bar-wrap { height: 4px; background: var(--surface2); border-radius: 20px; overflow: hidden; margin-top: 10px; }
.mini-bar { height: 100%; background: var(--accent); border-radius: 20px; width: 0%; transition: width 0.3s; }
.mini-label { font-size: 11px; color: var(--text2); margin-top: 4px; font-family: var(--mono); }
.mini-metrics { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.mini-metric { font-size: 11px; padding: 3px 8px; background: var(--surface2); border-radius: 6px; font-family: var(--mono); }

/* ACCURACY SUMMARY */
.acc-summary { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; margin-bottom: 12px; }
.acc-box { background: var(--surface2); border-radius: 10px; padding: 14px; text-align: center; }
.acc-val { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--accent); }
.acc-lbl { font-size: 11px; color: var(--text2); margin-top: 4px; }

/* CONFUSION MATRIX */
.cm-legend { display: flex; gap: 12px; margin-bottom: 10px; }
.cm-legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text2); }
.cm-dot { width: 12px; height: 12px; border-radius: 3px; }
.cm-dot.low { background: #f3f4f6; border: 1px solid var(--border); }
.cm-dot.high { background: var(--accent); }

.confusion-matrix { overflow-x: auto; }
.cm-placeholder { text-align: center; color: var(--text2); font-size: 12px; padding: 20px; }

.cm-table { border-collapse: collapse; width: 100%; }
.cm-table th {
  font-size: 11px; padding: 6px 8px; text-align: center;
  color: var(--text2); font-weight: 600; background: var(--surface2);
}
.cm-table td {
  padding: 0; text-align: center; position: relative;
  border: 1px solid var(--border);
}
.cm-cell {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 14px; font-weight: 600;
  width: 100%; height: 52px;
  transition: all 0.3s;
}
.cm-label-cell {
  font-size: 11px; font-weight: 700; padding: 6px;
  white-space: nowrap;
}

/* PER-CLASS STATS */
.per-class-stats { display: flex; flex-direction: column; gap: 8px; }
.pcls-row {
  display: grid; grid-template-columns: 100px 1fr 60px 60px 60px;
  align-items: center; gap: 8px; font-size: 12px;
  padding: 8px; border-radius: 8px;
  background: var(--surface2);
}
.pcls-name { font-weight: 700; }
.pcls-bar-wrap { height: 6px; background: var(--border); border-radius: 10px; overflow: hidden; }
.pcls-bar { height: 100%; border-radius: 10px; }
.pcls-val { font-family: var(--mono); font-size: 11px; text-align: right; }
.pcls-header {
  display: grid; grid-template-columns: 100px 1fr 60px 60px 60px;
  gap: 8px; font-size: 10px; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 0 8px; margin-bottom: 2px;
}

/* MISCLASSIFICATIONS */
.misc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px,1fr)); gap: 8px; }
.misc-item {
  border-radius: 8px; overflow: hidden;
  border: 2px solid var(--danger);
}
.misc-item img { width: 100%; height: 70px; object-fit: cover; display: block; }
.misc-label {
  font-size: 9px; padding: 3px 4px; background: var(--danger); color: #fff;
  text-align: center; line-height: 1.3;
}

/* CLASS CONFIG */
.class-config-list { display: flex; flex-direction: column; gap: 6px; }
.cfg-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px; border-radius: 8px; border: 1px solid var(--border);
  font-size: 13px;
}
.cfg-del {
  background: none; border: none; cursor: pointer;
  color: var(--text2); font-size: 14px; padding: 2px 6px;
  border-radius: 5px; transition: all 0.15s;
}
.cfg-del:hover { background: #fee2e2; color: var(--danger); }

/* PARAMS */
.params-list { display: flex; flex-direction: column; gap: 8px; }
.param-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.param-row label { color: var(--text2); }
.param-row input {
  width: 90px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 7px;
  padding: 5px 8px; font-family: var(--mono); font-size: 13px;
  color: var(--text);
}
.param-row input:focus { outline: none; border-color: var(--accent); }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; width: 320px; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.modal-box h3 { margin-bottom: 14px; font-size: 17px; }
.modal-box input { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font-family: var(--font); font-size: 14px; color: var(--text); margin-bottom: 12px; }
.modal-box input:focus { outline: none; border-color: var(--accent); }
.modal-colors { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.mcol { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: all 0.15s; }
.mcol.sel { border-color: #18181b; transform: scale(1.2); }
.modal-btns { display: flex; gap: 8px; }
.modal-btns .btn-primary { margin: 0; }
.modal-btns .btn-secondary { margin: 0; }

#toast-container { position: fixed; bottom: 16px; right: 16px; z-index: 999; display: flex; flex-direction: column; gap: 6px; }
.toast { background: var(--text); color: #fff; padding: 9px 15px; border-radius: 9px; font-size: 13px; animation: toastIn 0.3s ease; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes toastIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
