/* ─────────────────── style.css ──────────────────── */
:root {
  --bg-deep: #040812;
  --bg-panel: #0d1526;
  --bg-raised: #131f37;
  --bg-header: #080c18;
  --border: #1e2e4a;
  --border-light: #1a2a45;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --gold-primary: #d8ac51;
  --gold-light: #cd9d37;
  --gold-dark: #cd9d37;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; background: var(--bg-deep); color: var(--text-primary); height: 100vh; overflow: hidden; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

#app { display: flex; flex-direction: column; height: 100vh; }

/* ────────── HEADER (centered, stacked) ────────── */
#site-header { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.15rem; padding: 0.9rem 1.2rem 0.8rem; background: linear-gradient(135deg, var(--bg-header), var(--bg-deep)); border-bottom: 1px solid var(--border); }
#header-center { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; }
#site-subtitle { font-size: 2.0rem; font-weight: 700; color: var(--gold-primary); font-family: 'Outfit', Georgia, 'Times New Roman', serif; }
#tagline { font-size: 0.78rem; color: var(--gold-primary); }

/* ────────── HEADER — mobile: stack logo below name, tighten spacing ────────── */
@media (max-width: 480px) {
  #site-header {
    flex-direction: column;
    padding: 0.6rem 0.8rem 0.5rem;
    gap: 0.1rem;
  }

  #header-center {
    order: 1;
    gap: 0.1rem;
  }

  #site-subtitle {
    font-size: 1.15rem;
  }

  #tagline {
    font-size: 0.68rem;
  }
}

/* ────────── MAIN CONTENT (single card, static size) ────────── */
#main { display: flex; flex: 1; overflow: hidden; }
.panel { display: none; flex-direction: column; width: 100%; height: 100%; background: var(--bg-panel); border: none; border-radius: 0; overflow: hidden; }
.panel.active { display: flex; }

/* PC / monitors: fixed-width centered card that stretches to fill available height */
@media (min-width: 1024px) {
  #main { align-items: stretch; justify-content: center; padding: 0.8rem 1rem 0; }
  .panel {
    width: 660px;
    max-width: 92vw;
    border: 1px solid var(--border-light);
    border-radius: 16px 16px 0 0;
    margin: 0 auto;
  }
}

/* ────────── PANEL HEADER ────────── */
.panel-header { padding: 0.65rem 1rem; border-bottom: 1px solid var(--border); background: var(--bg-raised); }
.panel-header h2 { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }

/* ────────── SUB TABS (ROLEFIT / EXPORT) ────────── */
.sub-tabs { display: flex; gap: 0.4rem; padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--border); background: var(--bg-deep); }
.sub-tab { padding: 0.35rem 0.75rem; font-size: 0.78rem; color: var(--text-secondary); background: transparent; border: 1px solid var(--border-light); border-radius: 5px; cursor: pointer; transition: all 0.2s; }
.sub-tab.active { background: var(--gold-dark); color: #fff; border-color: var(--gold-primary); }
.sub-tab:hover:not(.active) { background: var(--bg-header); }

.sub-tab-content { display: flex; flex-direction: column; padding: 0.8rem; overflow-y: auto; flex: 1; }
.sub-tab-content.hidden { display: none; }

/* ────────── ROLE FIT PANEL ────────── */
#jd-paste { width: 100%; min-height: 145px; padding: 0.6rem; font-size: 0.85rem; color: var(--text-primary); background: var(--bg-raised); border: 1px solid var(--border-light); border-radius: 5px; resize: vertical; font-family: inherit; }
#jd-url { width: 100%; padding: 0.55rem; font-size: 0.85rem; color: var(--text-primary); background: var(--bg-raised); border: 1px solid var(--border-light); border-radius: 5px; margin-bottom: 0.6rem; }
#fetch-jd-btn, #analyze-btn, #download-convo-btn, #download-resume-btn { padding: 0.55rem 0.9rem; font-size: 0.85rem; font-weight: 600; color: #17130a; background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary)); border: none; border-radius: 5px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 0.4rem; justify-content: center; margin-top: 0.6rem; }
#analyze-btn:hover, #download-resume-btn:hover, #download-convo-btn:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(240, 192, 64, 0.35); }

#fit-results { margin-top: 1rem; padding: 0.8rem; background: var(--bg-raised); border: 1px solid var(--border-light); border-radius: 5px; }
#fit-results.hidden { display: none; }
#fit-score-wrap { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.7rem; }
#fit-score-label { font-size: 0.85rem; color: var(--text-secondary); }
#fit-score { font-size: 1.5rem; font-weight: 700; color: var(--gold-light); }
#fit-breakdown p { font-size: 0.82rem; color: #d1d5db; margin-bottom: 0.4rem; line-height: 1.45; }

/* ────────── CHAT PANEL (frosted-glass bubbles) ────────── */
#panel-chat { padding: 0; }
#chat-messages { flex: 1; overflow-y: auto; padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.8rem; }
.message { display: flex; }
.message.user { justify-content: flex-end; }
.message.assistant { justify-content: flex-start; }
.bubble { max-width: 70%; padding: 0.65rem 0.9rem; border-radius: 12px; font-size: 0.98rem; line-height: 1.5; white-space: pre-wrap; }
.message.user .bubble {
  background: linear-gradient(135deg, rgba(184,134,11,0.35), rgba(240,192,64,0.3));
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(253,230,138,0.45);
  color: #fff8e7;
  font-weight: 500;
}
.message.assistant .bubble {
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.10);
}

#chips-container { display: flex; flex-wrap: wrap; gap: 0.45rem; padding: 0.5rem 1.1rem; border-top: 1px solid var(--border); }
#chips-container.hidden { display: none; }
.chip { padding: 0.4rem 0.8rem; font-size: 0.85rem; color: var(--text-secondary); background: var(--bg-raised); border: 1px solid var(--border-light); border-radius: 14px; cursor: pointer; transition: all 0.2s; }
.chip:hover { background: var(--bg-header); color: var(--gold-light); }

#input-row { display: flex; gap: 0.6rem; padding: 0.6rem 1.1rem 0.75rem; border-top: 1px solid var(--border); background: var(--bg-deep); }
#input-wrap { flex: 1; position: relative; display: flex; align-items: center; }
#user-input { width: 100%; padding: 0.35rem 2.6rem 0.35rem 0.85rem; font-size: 0.98rem; color: var(--text-primary); background: var(--bg-raised); border: 1px solid var(--border-light); border-radius: 7px; font-family: inherit; }
#user-input:focus { outline: none; border-color: var(--gold-primary); }
#chips-toggle { position: absolute; right: 0.65rem; padding: 0.25rem; background: transparent; border: none; color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; }
#chips-toggle:hover { color: var(--gold-light); }
#send-btn { padding: 0.65rem 1rem; font-size: 0.87rem; color: #17130a; background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary)); border: none; border-radius: 7px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; }
#send-btn:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(240, 192, 64, 0.35); }
#send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.typing-dots { display: flex; align-items: center; gap: 4px; padding: 0.2rem 0; }
.typing-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--gold-light); opacity: 0.4; animation: typingBounce 1.2s infinite ease-in-out; }
.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}
.type-cursor { display: inline-block; width: 2px; height: 1em; background: var(--gold-primary); margin-left: 2px; vertical-align: text-bottom; animation: cursorBlink 0.8s steps(1) infinite; }
@keyframes cursorBlink { 50% { opacity: 0; } }

/* ────────── EXPORT PANEL ────────── */
.export-desc { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 0.8rem; line-height: 1.45; }
.export-desc code { padding: 0.15rem 0.35rem; background: var(--bg-header); color: var(--gold-light); border-radius: 4px; font-size: 0.78rem; }
#resume-job-title-wrap { margin-bottom: 0.8rem; }
#resume-job-title-wrap label { display: block; font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 0.3rem; }
#resume-job-title { width: 100%; padding: 0.55rem; font-size: 0.85rem; color: var(--text-primary); background: var(--bg-raised); border: 1px solid var(--border-light); border-radius: 5px; font-family: inherit; }
#resume-status { margin-top: 0.6rem; font-size: 0.82rem; color: var(--gold-light); }

/* ────────── MODE TABS (upside-down gold glass tabs, below the card) ────────── */
#mode-tabs { display: flex !important; justify-content: center; gap: 0.5rem; width: 100%; padding: 0 0.8rem 0.6rem; }
#mode-tabs .mode-tab {
  flex: 1;
  padding: 0.5rem 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(240, 192, 64, 0.08);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  border: 1px solid rgba(240, 192, 64, 0.25);
  border-top: none;
  border-radius: 0 0 10px 10px;
  cursor: pointer;
  transition: all 0.2s;
}
#mode-tabs .mode-tab.active { color: #17130a; background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary)); border-color: var(--gold-primary); }
#mode-tabs .mode-tab:hover:not(.active) { background: rgba(240, 192, 64, 0.16); color: var(--gold-light); }

@media (min-width: 1024px) {
  #mode-tabs { max-width: 660px; margin: 0 auto; }
}

/* ────────── FOOTER ────────── */
#site-footer { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; padding: 0.6rem 0 1.2rem; border-top: 1px solid var(--border); background: var(--bg-deep); }
#site-footer .social-links { display: flex; justify-content: center; gap: 1.3rem; }
#site-footer .social-links a { display: flex; align-items: center; gap: 0.35rem; font-size: 0.78rem; color: var(--text-secondary); transition: color 0.2s; }
#site-footer .social-links a:hover { color: var(--gold-primary); text-decoration: none; }
.footer-logo { font-family: 'Outfit', sans-serif; font-size: 2.05rem; font-weight: 800; color: var(--text-primary); letter-spacing: -0.02em; line-height: 1; user-select: none; }
.footer-logo span { color: var(--gold-primary); }