/* ===== InterviewAgent Design System =====
   Inspired by ChatGPT's clean, refined dark aesthetic.
   Palette: deep charcoals with subtle teal-green accent.
   Typography: system font stack with intentional hierarchy.
   Spacing: generous, breathable. Radius: 12px standard.
   Borders: barely-there rgba. Shadows: layered, subtle.
   ======================================== */

:root {
  /* Background layers — deeper and richer than before */
  --bg-base:       #0f0f0f;
  --bg-sidebar:    #0d0d0d;
  --bg-primary:    #141414;
  --bg-secondary:  #1a1a1a;
  --bg-tertiary:   #222222;
  --bg-hover:      #282828;
  --bg-active:     #2a2a2a;

  /* Text hierarchy */
  --text-primary:    #ececec;
  --text-secondary:  #9b9b9b;
  --text-muted:      #666666;

  /* Borders — barely visible */
  --border-subtle:   rgba(255,255,255,0.06);
  --border-default:  rgba(255,255,255,0.10);
  --border-strong:   rgba(255,255,255,0.14);

  /* Accent — muted, sophisticated teal-green */
  --accent:          #10a37f;
  --accent-hover:    #0d8c6d;
  --accent-subtle:   rgba(16,163,127,0.12);
  --accent-text:     #1ab88a;

  /* Semantic */
  --danger:          #ef4444;
  --danger-hover:    #dc2626;
  --danger-subtle:   rgba(239,68,68,0.12);
  --warning:         #eab308;
  --warning-subtle:  rgba(234,179,8,0.12);
  --success:         #22c55e;

  /* User / AI bubble colors */
  --user-bubble:     #2a2f3a;
  --ai-bubble:       #1e1e1e;

  /* Radii */
  --radius-sm:   8px;
  --radius:      12px;
  --radius-lg:   16px;
  --radius-xl:   20px;

  /* Shadows — subtle layers */
  --shadow-sm:   0 1px 2px rgba(0,0,0,0.3);
  --shadow:      0 2px 8px rgba(0,0,0,0.4);
  --shadow-lg:   0 4px 16px rgba(0,0,0,0.5);
  --shadow-xl:   0 8px 32px rgba(0,0,0,0.6);

  /* Typography */
  --font:        -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  --font-mono:   "SF Mono","Fira Code","Cascadia Code",Consolas,monospace;

  /* Layout */
  --sidebar-width:  260px;
  --chat-max-width: 768px;
  --header-height:  52px;

  /* Transitions */
  --transition-fast:   0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-slow:   0.3s ease;
}

/* ===== Reset & Base ===== */
*,*::before,*::after{margin:0;padding:0;box-sizing:border-box}

body{
  font-family:var(--font);
  font-size:15px;
  line-height:1.5;
  background:var(--bg-primary);
  color:var(--text-primary);
  height:100vh;
  overflow:hidden;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

#app{display:flex;height:100vh}

/* ===== Sidebar ===== */
#sidebar{
  width:var(--sidebar-width);
  min-width:var(--sidebar-width);
  background:var(--bg-sidebar);
  display:flex;
  flex-direction:column;
  border-right:1px solid var(--border-subtle);
  transition:width var(--transition-slow), min-width var(--transition-slow);
  z-index:10;
}
#sidebar.collapsed{width:0;min-width:0;overflow:hidden;border-right:none}

.sidebar-header{padding:14px 12px 10px}

/* New Chat button — ChatGPT-style pill */
.btn-new-chat{
  width:100%;
  padding:10px 14px;
  background:var(--accent);
  color:#fff;
  border:none;
  border-radius:var(--radius);
  cursor:pointer;
  font-size:14px;
  font-weight:500;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  transition:background var(--transition-fast), transform var(--transition-fast);
  letter-spacing:0.01em;
}
.btn-new-chat:hover{background:var(--accent-hover)}
.btn-new-chat:active{transform:scale(0.98)}

/* Sidebar nav */
.sidebar-nav{padding:6px 10px;display:flex;flex-direction:column;gap:2px}
.nav-item{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:var(--radius-sm);
  cursor:pointer;
  font-size:14px;
  color:var(--text-secondary);
  transition:all var(--transition-fast);
}
.nav-item:hover{background:var(--bg-hover);color:var(--text-primary)}
.nav-item.active{background:var(--bg-active);color:var(--text-primary);font-weight:500}
.nav-icon{font-size:18px;width:22px;text-align:center;flex-shrink:0;line-height:1}

/* Sidebar history */
.sidebar-history{flex:1;overflow-y:auto;padding:6px 10px}

.history-title{
  font-size:11px;
  font-weight:600;
  color:var(--text-muted);
  padding:12px 12px 6px;
  text-transform:uppercase;
  letter-spacing:0.04em;
}

.history-item{
  padding:8px 12px;
  border-radius:var(--radius-sm);
  cursor:pointer;
  font-size:13px;
  color:var(--text-secondary);
  transition:background var(--transition-fast);
  margin-bottom:1px;
}
.history-item:hover{background:var(--bg-hover);color:var(--text-primary)}
.history-preview{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  line-height:1.45;
  color:var(--text-primary);
}
.history-meta{
  font-size:11px;
  color:var(--text-muted);
  margin-top:3px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.history-empty{padding:8px 12px;font-size:13px;color:var(--text-muted)}

/* Sidebar footer */
.sidebar-footer{
  padding:12px;
  border-top:1px solid var(--border-subtle);
  margin-top:auto;
}
.user-info{
  display:flex;
  align-items:center;
  justify-content:space-between;
  font-size:13px;
  color:var(--text-secondary);
}

/* Sidebar recent */
.sidebar-recent{
  overflow-y:auto;
  padding:6px 10px;
  border-top:1px solid var(--border-subtle);
  max-height:180px;
}

/* ===== Main Area ===== */
#main{flex:1;display:flex;flex-direction:column;overflow:hidden;background:var(--bg-primary)}

/* ===== Header ===== */
.chat-header{
  display:flex;
  align-items:center;
  gap:12px;
  padding:0 16px;
  height:var(--header-height);
  min-height:var(--header-height);
  background:var(--bg-primary);
  border-bottom:1px solid var(--border-subtle);
}
.chat-title{font-weight:600;font-size:15px;flex:1;color:var(--text-primary)}

/* ===== Mode Content ===== */
.mode-content{display:none;flex-direction:column;height:100%}
.mode-content.active{display:flex}

/* ===== Chat Layout ===== */
.chat-layout{display:flex;flex:1;overflow:hidden}
.chat-main{flex:1;display:flex;flex-direction:column;overflow:hidden;min-width:0;max-width:var(--chat-max-width);margin:0 auto;width:100%}

/* Chat message area */
.chat-box{
  flex:1;
  overflow-y:auto;
  padding:24px 16px;
  scroll-behavior:smooth;
}

/* Welcome message */
.welcome-msg{
  text-align:center;
  padding:80px 20px 40px;
  color:var(--text-muted);
}
.welcome-msg h2{
  font-size:26px;
  font-weight:600;
  margin-bottom:12px;
  color:var(--text-primary);
  letter-spacing:-0.01em;
}
.welcome-msg p{
  font-size:15px;
  line-height:1.6;
  color:var(--text-secondary);
  max-width:480px;
  margin:0 auto;
}

/* ===== Chat Input Area — ChatGPT-style ===== */
.chat-input-area{
  display:flex;
  gap:8px;
  align-items:flex-end;
  padding:12px 16px 16px;
  background:var(--bg-primary);
}
.chat-input-area textarea{
  flex:1;
  padding:12px 16px;
  background:var(--bg-secondary);
  color:var(--text-primary);
  border:1px solid var(--border-strong);
  border-radius:var(--radius-lg);
  resize:none;
  font-family:var(--font);
  font-size:15px;
  line-height:1.5;
  outline:none;
  max-height:160px;
  transition:border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow:var(--shadow-sm);
}
.chat-input-area textarea:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px var(--accent-subtle);
}
.chat-input-area textarea::placeholder{color:var(--text-muted)}

/* Send button */
.btn-send{
  width:40px;
  height:40px;
  min-width:40px;
  background:var(--accent);
  color:#fff;
  border:none;
  border-radius:var(--radius);
  cursor:pointer;
  font-size:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  transition:background var(--transition-fast), transform var(--transition-fast), opacity var(--transition-fast);
}
.btn-send:hover{background:var(--accent-hover)}
.btn-send:active{transform:scale(0.95)}
.btn-send:disabled{opacity:0.4;cursor:not-allowed}

/* ===== Messages ===== */
.msg{
  display:flex;
  gap:12px;
  margin-bottom:24px;
  max-width:92%;
  animation:msgFadeIn 0.25s ease-out;
}
@keyframes msgFadeIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}
.msg.user{margin-left:auto;flex-direction:row-reverse}

.msg-avatar{
  width:30px;
  height:30px;
  min-width:30px;
  border-radius:var(--radius-sm);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:12px;
  font-weight:600;
}
.msg.user .msg-avatar{background:#6c5ce7;color:#fff}
.msg.assistant .msg-avatar{background:var(--accent);color:#fff}

.msg-content{
  padding:12px 16px;
  border-radius:var(--radius-lg);
  font-size:15px;
  line-height:1.6;
  word-break:break-word;
  white-space:pre-wrap;
}
.msg.user .msg-content{
  background:var(--user-bubble);
  border-bottom-right-radius:var(--radius-sm);
  color:var(--text-primary);
}
.msg.assistant .msg-content{
  background:var(--ai-bubble);
  border:1px solid var(--border-subtle);
  border-bottom-left-radius:var(--radius-sm);
}

/* Code blocks in messages */
.msg-content pre{
  background:rgba(0,0,0,0.4);
  padding:14px;
  border-radius:var(--radius-sm);
  overflow-x:auto;
  margin:10px 0;
  font-size:13px;
  font-family:var(--font-mono);
  line-height:1.5;
  border:1px solid var(--border-subtle);
}
.msg-content code{
  font-size:13px;
  font-family:var(--font-mono);
  background:rgba(255,255,255,0.06);
  padding:2px 5px;
  border-radius:4px;
}
.msg-content pre code{background:none;padding:0}

/* Typing indicator */
.typing .msg-avatar{animation:avatarPulse 1.2s ease-in-out infinite}
@keyframes avatarPulse{0%,100%{opacity:1}50%{opacity:0.5}}

/* Typing indicator dots */
.typing-indicator{display:flex;align-items:center;gap:5px;padding:4px 0}
.typing-indicator span{
  width:7px;height:7px;border-radius:50%;background:var(--text-muted);
  display:inline-block;animation:dotBounce 1.4s ease-in-out infinite;
}
.typing-indicator span:nth-child(2){animation-delay:0.2s}
.typing-indicator span:nth-child(3){animation-delay:0.4s}
@keyframes dotBounce{0%,80%,100%{transform:scale(0.6);opacity:0.4}40%{transform:scale(1);opacity:1}}

/* ===== Interview Progress ===== */
.interview-progress{
  display:flex;
  align-items:center;
  gap:0;
  padding:0 24px;
  height:56px;
  background:var(--bg-primary);
  border-bottom:1px solid var(--border-subtle);
}
.progress-step{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:13px;
  color:var(--text-muted);
  cursor:default;
  flex-shrink:0;
  transition:color var(--transition-normal);
}
.progress-step .step-num{
  width:28px;
  height:28px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:12px;
  font-weight:700;
  background:var(--bg-tertiary);
  border:2px solid var(--border-default);
  color:var(--text-muted);
  transition:all var(--transition-normal);
}
.progress-step.active{color:var(--text-primary)}
.progress-step.active .step-num{
  background:var(--accent);
  border-color:var(--accent);
  color:#fff;
  box-shadow:0 0 0 4px var(--accent-subtle);
}
.progress-step.done{color:var(--accent-text)}
.progress-step.done .step-num{
  background:var(--accent-hover);
  border-color:var(--accent);
  color:#fff;
}
.progress-step.done .step-label{color:var(--accent-text)}
.progress-line{
  flex:1;
  height:2px;
  background:var(--border-default);
  min-width:20px;
  margin:0 4px;
  border-radius:1px;
  transition:background var(--transition-normal);
}
.progress-line.done{background:var(--accent)}

/* ===== Interview Layout ===== */
.interview-layout{display:flex;flex:1;overflow:hidden}
.interview-main{flex:1;overflow-y:auto;padding:24px}

.interview-sidebar{
  width:280px;
  min-width:280px;
  background:var(--bg-sidebar);
  border-left:1px solid var(--border-subtle);
  overflow-y:auto;
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.sidebar-panel{
  background:var(--bg-secondary);
  border-radius:var(--radius);
  padding:14px;
  border:1px solid var(--border-subtle);
}
.sidebar-panel h4{
  font-size:13px;
  font-weight:600;
  margin-bottom:10px;
  color:var(--text-secondary);
  display:flex;
  align-items:center;
  gap:6px;
}

/* ===== Interview Cards ===== */
.interview-content,.skills-content,.knowledge-content{flex:1;overflow-y:auto;padding:20px}

.iv-card{
  background:var(--bg-secondary);
  border-radius:var(--radius-lg);
  padding:24px;
  margin-bottom:16px;
  border:1px solid var(--border-subtle);
  transition:border-color var(--transition-fast);
}
.iv-card:hover{border-color:var(--border-default)}
.iv-card h3{
  font-size:16px;
  font-weight:600;
  margin-bottom:16px;
  display:flex;
  align-items:center;
  gap:8px;
}
.iv-card textarea{
  width:100%;
  min-height:120px;
  padding:12px 14px;
  background:var(--bg-primary);
  color:var(--text-primary);
  border:1px solid var(--border-default);
  border-radius:var(--radius);
  font-family:var(--font);
  font-size:14px;
  line-height:1.55;
  resize:vertical;
  outline:none;
  transition:border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.iv-card textarea:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px var(--accent-subtle);
}
.iv-card input[type="file"]{color:var(--text-secondary);margin:8px 0;font-size:14px}

/* ===== Result Display ===== */
.result-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(150px,1fr));
  gap:12px;
  margin-bottom:16px;
}
.result-item{
  background:var(--bg-primary);
  padding:16px;
  border-radius:var(--radius);
  text-align:center;
  border:1px solid var(--border-subtle);
}
.result-item .val{font-size:28px;font-weight:700;color:var(--accent-text);letter-spacing:-0.01em}
.result-item .lbl{font-size:12px;color:var(--text-muted);margin-top:4px;font-weight:500;text-transform:uppercase;letter-spacing:0.03em}

.tag-list{display:flex;flex-wrap:wrap;gap:6px}
.tag{
  display:inline-block;
  padding:4px 12px;
  border-radius:20px;
  font-size:12px;
  font-weight:500;
  background:var(--bg-tertiary);
  color:var(--text-secondary);
  border:1px solid var(--border-subtle);
}
.tag.highlight{
  background:var(--accent-subtle);
  border-color:rgba(16,163,127,0.2);
  color:var(--accent-text);
}

/* ===== Interview Chat ===== */
.iv-chat-box{
  background:var(--bg-primary);
  border-radius:var(--radius-lg);
  padding:20px;
  min-height:320px;
  max-height:460px;
  overflow-y:auto;
  margin-bottom:12px;
  border:1px solid var(--border-subtle);
  display:flex;
  flex-direction:column;
  gap:14px;
}
.iv-chat-box .msg{max-width:88%}
.iv-chat-box .msg.assistant{align-self:flex-start}
.iv-chat-box .msg.assistant .msg-content{
  background:var(--bg-secondary);
  border:1px solid var(--border-subtle);
  border-bottom-left-radius:var(--radius-sm);
  padding:14px 18px;
  font-size:14px;
  line-height:1.65;
}
.iv-chat-box .msg.assistant .msg-avatar{
  background:var(--accent);
  color:#fff;
  font-size:11px;
  font-weight:700;
}
.iv-chat-box .msg.user{align-self:flex-end;flex-direction:row-reverse}
.iv-chat-box .msg.user .msg-content{
  background:var(--accent);
  color:#fff;
  border-bottom-right-radius:var(--radius-sm);
  padding:12px 16px;
  font-size:14px;
  line-height:1.55;
}
.iv-chat-box .msg.user .msg-avatar{background:#6c5ce7;color:#fff}

/* Interview header bar */
.iv-header{
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px 16px;
  background:var(--bg-secondary);
  border-radius:var(--radius);
  margin-bottom:12px;
  border:1px solid var(--border-subtle);
  flex-wrap:wrap;
}
.iv-header .iv-q-counter{font-size:14px;font-weight:600;color:var(--accent-text);white-space:nowrap}
.iv-header .iv-difficulty{
  font-size:12px;
  padding:3px 12px;
  border-radius:20px;
  font-weight:600;
  white-space:nowrap;
}
.iv-header .iv-difficulty.easy{background:var(--accent-subtle);color:var(--accent-text)}
.iv-header .iv-difficulty.medium{background:var(--warning-subtle);color:var(--warning)}
.iv-header .iv-difficulty.hard{background:var(--danger-subtle);color:var(--danger)}
.iv-header .iv-position{
  font-size:13px;
  color:var(--text-muted);
  flex:1;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.iv-header .iv-progress-mini{
  width:72px;
  height:4px;
  border-radius:2px;
  background:var(--bg-primary);
  overflow:hidden;
  flex-shrink:0;
}
.iv-header .iv-progress-mini-fill{
  height:100%;
  border-radius:2px;
  background:var(--accent);
  transition:width 0.5s ease;
}

/* Interview input area */
.iv-input-area{
  display:flex;
  gap:8px;
  align-items:center;
  padding:12px 16px;
  background:var(--bg-secondary);
  border-top:1px solid var(--border-subtle);
  border-radius:0 0 var(--radius-lg) var(--radius-lg);
}
.iv-input-area textarea{
  flex:1;
  padding:10px 14px;
  background:var(--bg-primary);
  color:var(--text-primary);
  border:1px solid var(--border-default);
  border-radius:var(--radius);
  resize:none;
  font-family:var(--font);
  font-size:14px;
  outline:none;
  transition:border var(--transition-fast);
  line-height:1.5;
  max-height:80px;
}
.iv-input-area textarea:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px var(--accent-subtle);
}
.iv-input-area .btn-send{height:38px;width:38px;min-width:38px;font-size:16px}
.iv-input-area .btn-secondary{padding:8px 14px;font-size:12px;white-space:nowrap}

/* Empty state in chat box */
.iv-chat-box .iv-empty{text-align:center;padding:48px 24px;color:var(--text-muted)}
.iv-chat-box .iv-empty .iv-empty-icon{font-size:40px;margin-bottom:16px;opacity:0.6}
.iv-chat-box .iv-empty p{font-size:14px;line-height:1.6}

/* ===== Score Display ===== */
.score-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 16px;
  border-radius:20px;
  font-weight:700;
  font-size:18px;
}
.score-high{background:var(--accent-subtle);color:var(--accent-text)}
.score-mid{background:var(--warning-subtle);color:var(--warning)}
.score-low{background:var(--danger-subtle);color:var(--danger)}

.dim-bar{margin:10px 0}
.dim-bar .dim-label{display:flex;justify-content:space-between;font-size:13px;margin-bottom:4px;font-weight:500}
.dim-bar .dim-track{height:6px;border-radius:3px;background:var(--bg-primary);overflow:hidden}
.dim-bar .dim-fill{height:100%;border-radius:3px;transition:width 0.6s ease}
.dim-fill.high{background:var(--accent)}
.dim-fill.mid{background:var(--warning)}
.dim-fill.low{background:var(--danger)}

/* ===== History Items ===== */
.hist-entry{
  padding:10px 12px;
  background:var(--bg-primary);
  border-radius:var(--radius-sm);
  margin-bottom:6px;
  cursor:pointer;
  font-size:13px;
  border:1px solid transparent;
  transition:all var(--transition-fast);
}
.hist-entry:hover{border-color:var(--accent);background:var(--bg-hover)}
.hist-entry .hist-date{color:var(--text-muted);font-size:11px;margin-top:3px}
.hist-entry .hist-score{font-weight:700;color:var(--accent-text)}
.hist-entry .hist-preview{
  font-size:12px;
  color:var(--text-secondary);
  line-height:1.4;
  margin:3px 0;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* ===== Modal History ===== */
.hist-preview-text{
  font-size:13px;
  color:var(--text-secondary);
  margin-top:6px;
  line-height:1.45;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.hist-card{
  background:var(--bg-primary);
  padding:16px;
  border-radius:var(--radius);
  margin-bottom:10px;
  cursor:pointer;
  border:1px solid var(--border-subtle);
  transition:all var(--transition-fast);
}
.hist-card:hover{border-color:var(--accent);background:var(--bg-hover)}
.hist-card .hist-meta{display:flex;justify-content:space-between;align-items:center}
.hist-card .hist-score-big{font-size:24px;font-weight:700}

/* ===== Section Dividers ===== */
.iv-section{margin-top:24px;padding-top:20px;border-top:1px solid var(--border-subtle)}
.iv-section h4{font-size:15px;font-weight:600;margin-bottom:12px;color:var(--text-secondary)}

/* ===== Buttons ===== */
.btn{
  padding:8px 16px;
  border:none;
  border-radius:var(--radius-sm);
  cursor:pointer;
  font-size:14px;
  font-weight:500;
  display:inline-flex;
  align-items:center;
  gap:6px;
  transition:all var(--transition-fast);
  letter-spacing:0.01em;
}
.btn-primary{background:var(--accent);color:#fff}
.btn-primary:hover{background:var(--accent-hover);box-shadow:var(--shadow-sm)}

.btn-secondary{
  background:var(--bg-tertiary);
  color:var(--text-primary);
  border:1px solid var(--border-default);
}
.btn-secondary:hover{background:var(--bg-hover);border-color:var(--border-strong)}

.btn-sm{
  padding:5px 12px;
  font-size:13px;
  border-radius:var(--radius-sm);
  background:var(--bg-tertiary);
  color:var(--text-secondary);
  border:1px solid var(--border-subtle);
  cursor:pointer;
  transition:all var(--transition-fast);
}
.btn-sm:hover{background:var(--bg-hover);color:var(--text-primary);border-color:var(--border-default)}

.btn-icon{
  width:34px;
  height:34px;
  background:none;
  border:none;
  color:var(--text-secondary);
  cursor:pointer;
  font-size:18px;
  border-radius:var(--radius-sm);
  display:flex;
  align-items:center;
  justify-content:center;
  transition:all var(--transition-fast);
}
.btn-icon:hover{background:var(--bg-hover);color:var(--text-primary)}

/* ===== Modals ===== */
.modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.65);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:1000;
  backdrop-filter:blur(4px);
  animation:modalFadeIn 0.2s ease;
}
@keyframes modalFadeIn{from{opacity:0}to{opacity:1}}

.modal-content{
  background:var(--bg-secondary);
  padding:28px;
  border-radius:var(--radius-lg);
  width:380px;
  box-shadow:var(--shadow-xl);
  border:1px solid var(--border-subtle);
  animation:modalSlideIn 0.25s ease;
}
@keyframes modalSlideIn{from{opacity:0;transform:translateY(12px) scale(0.97)}to{opacity:1;transform:translateY(0) scale(1)}}

.modal-content h3{font-size:18px;font-weight:600;margin-bottom:20px;color:var(--text-primary)}

.modal-content input{
  width:100%;
  padding:10px 14px;
  margin-bottom:10px;
  background:var(--bg-primary);
  color:var(--text-primary);
  border:1px solid var(--border-default);
  border-radius:var(--radius-sm);
  font-size:14px;
  font-family:var(--font);
  outline:none;
  transition:border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.modal-content input:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px var(--accent-subtle);
}

.modal-btns{display:flex;gap:8px;margin-top:12px}

.login-msg{font-size:13px;color:var(--danger);margin-top:10px}
.login-hint{font-size:12px;color:var(--text-muted);margin-top:10px;text-align:center}

/* ===== Toast ===== */
.toast{
  position:fixed;
  top:20px;
  right:20px;
  padding:12px 20px;
  border-radius:var(--radius);
  color:#fff;
  z-index:2000;
  font-size:14px;
  font-weight:500;
  max-width:400px;
  box-shadow:var(--shadow-lg);
  animation:toastSlideIn 0.3s ease;
}
@keyframes toastSlideIn{from{transform:translateX(100%);opacity:0}to{transform:translateX(0);opacity:1}}
.toast.success{background:var(--success)}
.toast.error{background:var(--danger)}
.toast.info{background:#2563eb}

/* ===== Skills Page ===== */
.skills-hero{text-align:center;padding:40px 24px 32px}
.skills-hero h2{font-size:24px;font-weight:600;margin-bottom:10px;color:var(--text-primary);letter-spacing:-0.01em}
.skills-hero p{color:var(--text-muted);font-size:14px;line-height:1.6;max-width:520px;margin:0 auto}

.skills-section{margin-bottom:12px}
.skills-section-title{
  font-size:11px;
  font-weight:600;
  color:var(--text-muted);
  padding:0 24px 10px;
  text-transform:uppercase;
  letter-spacing:0.05em;
}
.skills-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(300px,1fr));
  gap:10px;
  padding:0 24px 20px;
}

.skill-card{
  display:flex;
  align-items:center;
  gap:14px;
  background:var(--bg-secondary);
  border:1px solid var(--border-subtle);
  border-radius:var(--radius);
  padding:18px 20px;
  cursor:pointer;
  transition:all var(--transition-normal);
}
.skill-card:hover{
  border-color:var(--accent);
  background:var(--bg-tertiary);
  transform:translateY(-2px);
  box-shadow:var(--shadow);
}
.skill-icon{
  font-size:24px;
  flex-shrink:0;
  width:48px;
  height:48px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--bg-primary);
  border-radius:var(--radius);
  border:1px solid var(--border-subtle);
}
.skill-body{flex:1;min-width:0}
.skill-name{font-size:15px;font-weight:600;color:var(--text-primary);margin-bottom:3px}
.skill-desc{font-size:13px;color:var(--text-muted);line-height:1.45}
.skill-arrow{
  color:var(--text-muted);
  font-size:16px;
  flex-shrink:0;
  transition:transform var(--transition-fast), color var(--transition-fast);
}
.skill-card:hover .skill-arrow{transform:translateX(3px);color:var(--accent-text)}

/* ===== Knowledge Page ===== */
.doc-item{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:12px 14px;
  background:var(--bg-secondary);
  border-radius:var(--radius-sm);
  margin-bottom:6px;
  border:1px solid var(--border-subtle);
}
.doc-name{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  flex:1;
  margin-right:12px;
  font-size:14px;
  color:var(--text-primary);
}
.knowledge-toolbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px}

.btn-danger-sm{
  padding:5px 12px;
  font-size:12px;
  border-radius:var(--radius-sm);
  background:transparent;
  color:var(--danger);
  border:1px solid rgba(239,68,68,0.3);
  cursor:pointer;
  font-weight:500;
  transition:all var(--transition-fast);
}
.btn-danger-sm:hover{background:var(--danger);color:#fff;border-color:var(--danger)}

.upload-zone{
  border:2px dashed var(--border-default);
  border-radius:var(--radius-lg);
  padding:48px;
  text-align:center;
  cursor:pointer;
  color:var(--text-muted);
  margin-bottom:16px;
  transition:all var(--transition-normal);
}
.upload-zone:hover{border-color:var(--accent);color:var(--accent-text);background:var(--accent-subtle)}

.msg .btn{margin-top:10px}
.msg .btn+.btn{margin-left:8px}

/* ===== Spinner ===== */
.spin{display:inline-block;animation:spinner 0.8s linear infinite}
@keyframes spinner{to{transform:rotate(360deg)}}

/* ===== Debug Panel ===== */
.btn-debug-wrap{position:relative;flex-shrink:0}
.btn-debug{
  background:transparent;
  border:1px solid var(--border-subtle);
  color:var(--text-muted);
}
.btn-debug:hover,.btn-debug.active{
  color:var(--accent-text);
  border-color:var(--accent);
}

.debug-popup{
  width:340px;
  max-height:440px;
  background:var(--bg-secondary);
  border:1px solid var(--border-default);
  border-radius:var(--radius-lg);
  box-shadow:var(--shadow-xl);
  overflow-y:auto;
  z-index:1000;
  animation:popupIn 0.15s ease-out;
}
@keyframes popupIn{from{opacity:0;transform:translateY(6px) scale(0.98)}to{opacity:1;transform:translateY(0) scale(1)}}

.debug-popup-menu{display:flex;flex-direction:column;padding:6px}
.debug-popup-btn{
  display:flex;
  align-items:center;
  gap:10px;
  width:100%;
  padding:11px 14px;
  background:transparent;
  border:none;
  border-radius:var(--radius-sm);
  color:var(--text-primary);
  font-size:13px;
  font-family:var(--font);
  cursor:pointer;
  text-align:left;
  transition:background var(--transition-fast);
}
.debug-popup-btn:hover{background:var(--bg-hover)}
.debug-popup-btn .icon{font-size:16px}

.debug-popup-body{padding:16px}
.debug-popup-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:12px;
  font-weight:600;
  font-size:13px;
  color:var(--text-primary);
}
.debug-popup-back{
  background:none;
  border:none;
  color:var(--text-muted);
  cursor:pointer;
  font-size:12px;
  padding:3px 8px;
  border-radius:4px;
  font-family:var(--font);
}
.debug-popup-back:hover{color:var(--accent-text);background:var(--bg-hover)}

.debug-loading{color:var(--text-muted);font-size:12px}

.debug-usage-bar{
  height:6px;
  border-radius:3px;
  background:var(--bg-primary);
  margin:10px 0;
  overflow:hidden;
}
.debug-usage-bar-fill{height:100%;border-radius:3px;transition:width 0.4s,background 0.4s}
.debug-usage-fill-safe{background:var(--accent)}
.debug-usage-fill-warn{background:var(--warning)}
.debug-usage-fill-danger{background:var(--danger)}

.debug-usage-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:6px}
.debug-usage-item{
  background:var(--bg-primary);
  border-radius:var(--radius-sm);
  padding:10px 12px;
  text-align:center;
  border:1px solid var(--border-subtle);
}
.debug-usage-item .val{font-size:15px;font-weight:700;color:var(--text-primary)}
.debug-usage-item .lbl{font-size:11px;color:var(--text-muted);margin-top:2px;text-transform:uppercase;letter-spacing:0.03em}

.debug-tool-item{
  padding:5px 0;
  color:var(--text-secondary);
  font-size:12px;
  border-bottom:1px solid var(--border-subtle);
  line-height:1.4;
}
.debug-tool-item:last-child{border-bottom:none}
.debug-tool-item b{color:var(--accent-text);font-weight:600}

/* Popup upload zone */
.popup-upload-zone{
  border:2px dashed var(--border-default);
  border-radius:var(--radius);
  padding:28px 16px;
  text-align:center;
  cursor:pointer;
  color:var(--text-muted);
  transition:all var(--transition-fast);
  margin:8px 0;
}
.popup-upload-zone:hover,.popup-upload-zone-active{
  border-color:var(--accent);
  color:var(--accent-text);
  background:var(--accent-subtle);
}
.popup-upload-icon{font-size:28px;margin-bottom:8px;opacity:0.7}
.popup-upload-zone p{font-size:13px;margin:0;line-height:1.5}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar{width:6px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:rgba(255,255,255,0.1);border-radius:3px}
::-webkit-scrollbar-thumb:hover{background:rgba(255,255,255,0.18)}

/* ===== Focus Visible ===== */
:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:2px}
textarea:focus-visible{outline:none}

/* ===== Reduced Motion ===== */
@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:0.01ms!important;animation-iteration-count:1!important;transition-duration:0.01ms!important}
}

/* ===== Responsive ===== */
@media(max-width:768px){
  #sidebar{width:0;min-width:0;border-right:none}
  #sidebar.collapsed{width:var(--sidebar-width);min-width:var(--sidebar-width);position:fixed;inset:0 auto 0 0;z-index:100;border-right:1px solid var(--border-subtle)}
  .msg{max-width:95%}
  .skills-grid{grid-template-columns:1fr;padding:0 16px 16px}
  .skills-hero h2{font-size:20px}
  .skills-hero{padding:28px 16px 24px}
  .skills-section-title{padding:0 16px 10px}
  .debug-popup{width:300px;max-height:380px}
  .interview-sidebar{width:240px;min-width:240px}
  .chat-box{padding:16px 12px}
  .welcome-msg{padding:60px 16px 32px}
  .chat-input-area{padding:10px 12px 14px}
  .interview-main{padding:16px}
}
