/* === DESIGN TOKENS === */
:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #111128;
  --bg-card: rgba(255,255,255,0.04);
  --bg-card-hover: rgba(255,255,255,0.07);
  --bg-glass: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.15);
  --text-primary: #f0f0f5;
  --text-secondary: #8b8ba3;
  --text-muted: #5a5a7a;
  --accent: #6366f1;
  --accent-glow: rgba(99,102,241,0.3);
  --green: #22c55e;
  --green-bg: rgba(34,197,94,0.12);
  --yellow: #eab308;
  --yellow-bg: rgba(234,179,8,0.12);
  --orange: #f97316;
  --orange-bg: rgba(249,115,22,0.12);
  --red: #ef4444;
  --red-bg: rgba(239,68,68,0.12);
  --sidebar-w: 240px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --transition: 0.2s ease;
  --font: 'Inter', -apple-system, sans-serif;
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: var(--font); background: var(--bg-primary); color: var(--text-primary); min-height: 100vh; display: flex; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: var(--font); outline: none; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-w); height: 100vh; position: fixed; left: 0; top: 0; z-index: 100;
  background: var(--bg-secondary); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 12px;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 32px; }
.logo-img { width: 38px; height: 38px; object-fit: contain; filter: drop-shadow(0 0 8px rgba(239,68,68,0.3)); }
.logo-text { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
.logo-accent { color: #ef4444; font-weight: 800; }
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius-sm);
  color: var(--text-secondary); transition: var(--transition); font-weight: 500;
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.nav-item.active { background: rgba(99,102,241,0.12); color: var(--accent); }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.api-status { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text-muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.status-dot.connected { background: var(--green); box-shadow: 0 0 6px var(--green); }

/* === MAIN CONTENT === */
.main-content { margin-left: var(--sidebar-w); flex: 1; padding: 28px 32px; min-height: 100vh; }

/* === PAGE HEADER === */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 6px; }
.page-header p { color: var(--text-secondary); font-size: 0.95rem; }

/* === CARDS === */
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; backdrop-filter: blur(12px); transition: var(--transition);
}
.card:hover { border-color: var(--border-hover); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-title { font-size: 1rem; font-weight: 600; }

/* === KPI GRID === */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; position: relative; overflow: hidden;
}
.kpi-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), #a855f7);
}
.kpi-card.green::before { background: linear-gradient(90deg, var(--green), #4ade80); }
.kpi-card.yellow::before { background: linear-gradient(90deg, var(--yellow), #facc15); }
.kpi-card.orange::before { background: linear-gradient(90deg, var(--orange), #fb923c); }
.kpi-card.red::before { background: linear-gradient(90deg, var(--red), #f87171); }
.kpi-label { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-size: 2rem; font-weight: 800; line-height: 1; }
.kpi-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 6px; }

/* === GRID LAYOUTS === */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-bottom: 24px; }

/* === TABLE === */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 12px 16px; text-align: left; font-weight: 600; font-size: 0.8rem;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary);
  background: rgba(255,255,255,0.02); border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--bg-card-hover); }
tbody tr:last-child td { border-bottom: none; }

/* === BADGES === */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: 20px; font-size: 0.75rem; font-weight: 600;
}
.badge-excellent { background: var(--green-bg); color: var(--green); }
.badge-good { background: var(--yellow-bg); color: var(--yellow); }
.badge-acceptable { background: var(--orange-bg); color: var(--orange); }
.badge-unacceptable { background: var(--red-bg); color: var(--red); }
.badge-new { background: rgba(99,102,241,0.12); color: var(--accent); }
.badge-processing { background: rgba(168,85,247,0.12); color: #a855f7; }
.badge-error { background: var(--red-bg); color: var(--red); }

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px;
  border-radius: var(--radius-sm); font-weight: 600; font-size: 0.85rem;
  transition: var(--transition); border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #5558e6; box-shadow: 0 4px 16px var(--accent-glow); }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-danger { background: var(--red-bg); color: var(--red); border-color: rgba(239,68,68,0.2); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-success { background: var(--green-bg); color: var(--green); border-color: rgba(34,197,94,0.2); }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* === FORM INPUTS === */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }
.input, select, textarea {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; color: var(--text-primary); font-size: 0.9rem; transition: var(--transition);
}
.input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
select { cursor: pointer; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8ba3' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
select option { background: #1a1a2e; color: var(--text-primary); padding: 8px 12px; }
textarea { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 16px; margin-bottom: 16px; }
.form-row > * { flex: 1; }

/* === PROGRESS BAR === */
.progress-bar { height: 8px; background: rgba(255,255,255,0.06); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.progress-fill.excellent { background: linear-gradient(90deg, var(--green), #4ade80); }
.progress-fill.good { background: linear-gradient(90deg, var(--yellow), #facc15); }
.progress-fill.acceptable { background: linear-gradient(90deg, var(--orange), #fb923c); }
.progress-fill.unacceptable { background: linear-gradient(90deg, var(--red), #f87171); }

/* === EVALUATION BLOCKS === */
.eval-block { margin-bottom: 16px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.eval-block-header {
  display: flex; justify-content: space-between; align-items: center; padding: 14px 18px;
  background: rgba(255,255,255,0.02); cursor: pointer; transition: var(--transition);
}
.eval-block-header:hover { background: rgba(255,255,255,0.04); }
.eval-block-name { font-weight: 600; display: flex; align-items: center; gap: 10px; }
.eval-block-score { display: flex; align-items: center; gap: 12px; }
.eval-block-score .score-text { font-weight: 700; font-size: 0.95rem; }
.eval-block-body { padding: 0; max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.eval-block.open .eval-block-body { max-height: 2000px; }
.eval-block .chevron { transition: transform 0.3s; }
.eval-block.open .chevron { transform: rotate(180deg); }

.criteria-row {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 18px;
  border-top: 1px solid var(--border); font-size: 0.85rem;
}
.criteria-row:hover { background: rgba(255,255,255,0.02); }
.criteria-name { flex: 1; color: var(--text-secondary); padding-right: 16px; }
.criteria-weight { width: 40px; text-align: center; color: var(--text-muted); font-size: 0.75rem; }
.criteria-score { width: 60px; text-align: center; font-weight: 700; }
.criteria-score.yes { color: var(--green); }
.criteria-score.no { color: var(--red); }
.criteria-score.na { color: var(--text-muted); }
.criteria-comment { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; font-style: italic; }

/* === MODAL === */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; padding: 32px;
}
.modal-overlay.active { display: flex; }
.modal-content {
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius);
  max-width: 900px; width: 100%; max-height: 85vh; overflow-y: auto; padding: 28px;
  box-shadow: var(--shadow); animation: modalIn 0.25s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h2 { font-size: 1.3rem; font-weight: 700; }
.modal-close { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--transition); }
.modal-close:hover { background: var(--red-bg); color: var(--red); border-color: rgba(239,68,68,0.3); }

/* === TOAST === */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 14px 20px; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 500;
  box-shadow: var(--shadow); animation: toastIn 0.3s ease;
  display: flex; align-items: center; gap: 10px; min-width: 300px;
}
.toast-success { background: #0f2e1a; border: 1px solid rgba(34,197,94,0.3); color: var(--green); }
.toast-error { background: #2e0f0f; border: 1px solid rgba(239,68,68,0.3); color: var(--red); }
.toast-info { background: #0f1a2e; border: 1px solid rgba(99,102,241,0.3); color: var(--accent); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

/* === SCORE CIRCLE === */
.score-circle { position: relative; width: 120px; height: 120px; }
.score-circle svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-circle circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.score-circle .bg { stroke: rgba(255,255,255,0.06); }
.score-circle .fill { transition: stroke-dashoffset 1s ease; }
.score-circle .value { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 1.5rem; font-weight: 800; text-align: center; }
.score-circle .value small { display: block; font-size: 0.65rem; font-weight: 400; color: var(--text-secondary); }

/* === TOOLBAR === */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.toolbar .spacer { flex: 1; }

/* === EMPTY STATE === */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 8px; }

/* === LOADING === */
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* === OPERATOR LIST === */
.operator-item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.operator-item:last-child { border-bottom: none; }
.operator-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #a855f7); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; }
.operator-info { flex: 1; }
.operator-info .name { font-weight: 600; font-size: 0.9rem; }
.operator-info .hotel { font-size: 0.75rem; color: var(--text-muted); }
.operator-score { font-weight: 700; font-size: 1.1rem; }

/* === TRANSCRIPT === */
.transcript-box {
  background: rgba(0,0,0,0.3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px; max-height: 300px; overflow-y: auto; font-size: 0.85rem;
  line-height: 1.7; color: var(--text-secondary); white-space: pre-wrap;
}

/* === TABS === */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--bg-card); border-radius: var(--radius-sm); padding: 4px; border: 1px solid var(--border); width: fit-content; }
.tab { padding: 8px 16px; border-radius: 6px; font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); cursor: pointer; transition: var(--transition); }
.tab.active { background: var(--accent); color: #fff; }
.tab:hover:not(.active) { color: var(--text-primary); }

/* === PAGINATION === */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 20px; }
.pagination button { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; }
.pagination button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination button:hover:not(.active):not(:disabled) { border-color: var(--border-hover); }

/* === ANIMATIONS === */
.fade-in { animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .sidebar { width: 60px; padding: 12px 6px; }
  .sidebar .logo-text, .sidebar .nav-item span, .sidebar-footer span { display: none; }
  .main-content { margin-left: 60px; padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .toolbar { flex-direction: column; align-items: stretch; }
}
