.preview-wrap::-webkit-scrollbar {
  width: 0;
  height: 0;
}
.preview-wrap {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
:root {
  --bg: #0d1630;
  --panel: #12224b;
  --panel-elev: #0f1d44;
  --ink: #f7f9ff;
  --ink-strong: #ffffff;
  --muted: #c4d2fb;
  --accent: #63b3ff;
  --accent-strong: #8bd0ff;
  --line: #304a83;
  --shadow: 0 10px 32px rgba(0, 0, 0, 0.36), 0 4px 12px rgba(0, 0, 0, 0.3);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
/* Hide all scrollbars globally but keep elements scrollable */
*::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
}
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
html,
body {
  margin: 0;
  background: radial-gradient(
      1200px 800px at 20% -10%,
      #1a2f6b 0%,
      transparent 60%
    ),
    radial-gradient(1200px 800px at 120% 10%, #1e407b 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  font: 16px/1.55 ui-sans-serif, system-ui, Segoe UI, Roboto, "Helvetica Neue",
    Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-y: auto; /* allow page scroll to reach AI Tailor section */
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
a {
  color: var(--accent);
}
.wrap {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  position: relative; /* ensure content sits above background glow */
  z-index: 1;
}

/* Gemini call background glow animations (centered & brighter) */
body.gemini-glow::before,
body.gemini-glow-exit::before {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0; /* behind .wrap (which is z-index:1) */
  /* big centered bright radial glow that reaches page edges */
  background: radial-gradient(
    circle at 50% 50%,
    rgba(255, 255, 255, 0.6) 0%,
    rgba(255, 255, 255, 0.45) 18%,
    rgba(255, 255, 255, 0.3) 38%,
    rgba(255, 255, 255, 0.18) 60%,
    rgba(255, 255, 255, 0.08) 80%,
    rgba(255, 255, 255, 0.02) 95%,
    transparent 100%
  );
  filter: blur(42px);
  background-repeat: no-repeat;
  background-size: cover;
}

@keyframes glowIn {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes glowFloat {
  0% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-18px) scale(1.01);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}
@keyframes glowPulse {
  0% {
    transform: translateY(0) scale(1);
    filter: blur(42px) brightness(1);
    opacity: 1;
  }
  50% {
    transform: translateY(-8px) scale(1.02);
    filter: blur(48px) brightness(1.18);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1);
    filter: blur(42px) brightness(1);
    opacity: 1;
  }
}
@keyframes glowOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(40px) scale(0.98);
  }
}

body.gemini-glow::before {
  animation: glowIn 380ms cubic-bezier(0.2, 0.9, 0.3, 1) forwards,
    glowFloat 2400ms ease-in-out 380ms infinite,
    glowPulse 1800ms ease-in-out 380ms infinite;
}

body.gemini-glow-exit::before {
  animation: glowOut 420ms ease forwards;
}
header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
header h1 {
  font-size: 20px;
  margin: 0;
  letter-spacing: 0.3px;
}
.row[style] {
  /* keep inline styles but improve spacing subtly */
  gap: 8px !important;
}
.grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-elev));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
/* Make both Inputs and Preview panels same height and scrollable */
.grid > section.card:first-child,
.grid > section.card:last-child {
  overflow-y: auto;
  max-height: 80vh; /* limit height so AI Tailor section is reachable */
}
.grid > section.card:first-child::-webkit-scrollbar,
.grid > section.card:last-child::-webkit-scrollbar {
  width: 0;
  height: 0;
}
.grid > section.card:first-child, /* Firefox */
.grid > section.card:last-child {
  scrollbar-width: none;
}
.grid > section.card:first-child, /* IE/Edge */
.grid > section.card:last-child {
  -ms-overflow-style: none;
}
/* AI Tailor section styling */
.ai-tailor-section {
  max-width: 100%;
}
.card h2 {
  font-size: 14px;
  margin: 0 0 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0 6px;
}
/* Collapsible section styling */
details.section {
  margin: 8px 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
}
details.section > summary {
  list-style: none;
  cursor: pointer;
  color: var(--ink-strong);
  font-weight: 700;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
details.section > summary::-webkit-details-marker {
  display: none;
}
details.section > summary:before {
  content: "\25BC";
  font-size: 10px;
  transform: rotate(0deg);
  transition: transform 160ms var(--ease);
  color: var(--accent);
}
details.section[open] > summary:before {
  transform: rotate(180deg);
}
/* spacing between summary and content */
details.section[open] > *:not(summary) {
  animation: fadeIn 160ms var(--ease);
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* Section header emphasis */
label + #projectsArea,
label + #experienceArea,
label + #educationArea {
  margin-top: 6px;
}
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  background: #0a1323;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 11px;
  outline: none;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease),
    background 160ms var(--ease), transform 120ms var(--ease);
  max-width: 100%;
}
textarea {
  min-height: 88px;
  resize: vertical;
}
.preview textarea {
  background: #f8f9ff;
}
.row {
  display: flex;
  gap: 8px;
}
.row > * {
  flex: 1;
  min-width: 0; /* prevents overflow in flex children */
}
.btnbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
/* Section add buttons more prominent and separated */
button.add-section {
  width: 100%;
  justify-content: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(180deg, #3e86ff, #2b5ed6);
  border-color: #3a76e0;
}
button.add-section:hover {
  background: linear-gradient(180deg, #5a98ff, #3768e2);
}
button {
  background: linear-gradient(180deg, #2e6fd3, #1f4fb2);
  color: #fff;
  border: 1px solid #2f59b3;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 120ms var(--ease), box-shadow 160ms var(--ease),
    background 160ms var(--ease), border-color 160ms var(--ease);
}
button.secondary {
  background: #101a2a;
  border-color: var(--line);
  color: var(--muted);
}
button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}
button:active {
  transform: translateY(0);
  box-shadow: none;
}
input:focus,
input:hover,
textarea:focus,
textarea:hover,
select:focus,
select:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 179, 255, 0.22);
}
.pill {
  display: inline-block;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
}
.preview-wrap {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: auto; /* enable scrolling to reach bottom of scaled page */
}
.preview {
  background: #fff;
  color: #111;
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, Segoe UI,
    Roboto, Arial, sans-serif;
}
.preview.resume {
  width: 210mm; /* A4 width */
  height: 297mm; /* A4 height */
  margin: 0; /* centered by wrap */
  overflow: auto; /* allow internal scroll if needed */
  transform-origin: top center;
}
.resume h1 {
  font: 700 26px/1.1 "Inter", ui-sans-serif, system-ui;
  margin: 0 0 2px;
}
.small {
  color: #333;
  font-size: 13px;
}
.sec {
  margin-top: 18px;
}
.sec h3 {
  margin: 0 0 6px;
  font-size: 15px;
  border-bottom: 1px solid #eee;
  padding-bottom: 4px;
}
.item {
  margin: 6px 0;
}
.project-block,
.exp-block,
.edu-block {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin: 10px 0;
}
.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.block-title {
  font-weight: 700;
  color: var(--ink-strong);
}
.block-controls {
  display: flex;
  gap: 4px;
  align-items: center;
}
.move-btn {
  padding: 4px 6px;
  font-size: 12px;
  min-width: 24px;
  background: var(--panel-elev);
  border: 1px solid var(--line);
  color: var(--muted);
}
.move-btn:hover {
  background: var(--accent);
  color: var(--ink-strong);
  border-color: var(--accent);
}
.block-delete {
  padding: 6px 8px;
}
/* Subtle distinct coloration per section for easier visual parsing */
.project-block {
  background: rgba(99, 179, 255, 0.07);
  border-color: rgba(99, 179, 255, 0.35);
}
.exp-block {
  background: rgba(96, 211, 173, 0.07);
  border-color: rgba(96, 211, 173, 0.35);
}
.edu-block {
  background: rgba(187, 154, 255, 0.07);
  border-color: rgba(187, 154, 255, 0.35);
}
/* Skills field tint */
#skills {
  background: rgba(255, 200, 120, 0.07);
  border-color: rgba(255, 200, 120, 0.35);
}
.project-block .bullets,
.exp-block .bullets {
  display: grid;
  gap: 8px;
}
.proj-bullet,
.exp-bullet {
  overflow: auto;
}
/* Hide scrollbars for bullet textareas (still scrollable) */
.proj-bullet::-webkit-scrollbar,
.exp-bullet::-webkit-scrollbar {
  width: 0;
  height: 0;
}
.proj-bullet,
.exp-bullet {
  /* Firefox */
  scrollbar-width: none;
}
.proj-bullet,
.exp-bullet {
  /* IE/Edge legacy */
  -ms-overflow-style: none;
}
.project-block .add-bullet,
.exp-block .add-bullet {
  margin-top: 8px;
  width: 100%;
  background: #142a4a;
  color: var(--accent-strong);
  border-color: #244a8a;
}
.bul {
  margin: 0;
  padding-left: 18px;
}
.muted {
  color: #666;
}
.rewrites {
  margin-top: 10px;
  background: #0b1426;
  border: 1px dashed #35466b;
  border-radius: var(--radius-sm);
  padding: 12px;
}
.rewrite-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 6px 0;
}
.rewrite-item textarea {
  min-height: 60px;
}
.rewrite-item .actions {
  display: flex;
  gap: 6px;
}
/* Keyword chips UI */
.keyword-chips {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(
    180deg,
    rgba(99, 179, 255, 0.12),
    rgba(99, 179, 255, 0.06)
  );
  color: var(--ink-strong);
  border: 1px solid rgba(99, 179, 255, 0.3);
  padding: 6px 8px;
  border-radius: 999px;
  font-size: 13px;
}
.chip .remove {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  font-weight: 700;
}
.chip .remove:hover {
  color: var(--accent-strong);
}
.chip-input-row {
  display: flex;
  gap: 8px;
}
.chip-input-row input[type="text"] {
  flex: 1;
  min-width: 0;
}
/* Optimized Inputs Editor (AI Tailor) - match the main Inputs panel look */
#optimizedInputsEditor {
  background: linear-gradient(180deg, var(--panel), var(--panel-elev));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--ink);
  box-shadow: var(--shadow);
  min-height: 420px;
  overflow: auto;
}
#optimizedInputsEditor .row {
  display: flex;
  gap: 8px;
}
#optimizedInputsEditor .row > * {
  flex: 1;
  min-width: 0;
}
#optimizedInputsEditor label {
  color: var(--muted);
  margin-top: 8px;
  display: block;
}
#optimizedInputsEditor input,
#optimizedInputsEditor input[type="text"],
#optimizedInputsEditor input[type="email"],
#optimizedInputsEditor input[type="password"],
#optimizedInputsEditor textarea,
#optimizedInputsEditor select {
  width: 100%;
  background: #0a1323;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  outline: none;
}
#optimizedInputsEditor input:focus,
#optimizedInputsEditor textarea:focus,
#optimizedInputsEditor select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 179, 255, 0.12);
}
#optimizedInputsEditor textarea {
  min-height: 60px;
  resize: vertical;
}

/* project/exp/edu blocks inside editor should visually match input blocks */
#optimizedInputsEditor .project-block,
#optimizedInputsEditor .exp-block,
#optimizedInputsEditor .edu-block {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(230, 239, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin: 8px 0;
}
#optimizedInputsEditor .project-block .proj-bullets,
#optimizedInputsEditor .exp-block .exp-bullets {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}
#optimizedInputsEditor .proj-bullet,
#optimizedInputsEditor .exp-bullet {
  width: 100%;
  min-height: 40px;
  padding: 8px;
  background: #071228;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
}

/* Make add/remove buttons a little smaller inside the editor */
#optimizedInputsEditor button {
  font-size: 13px;
  padding: 8px 10px;
}

/* Ensure section add buttons are still prominent */
#optimizedInputsEditor button.add-section {
  width: 100%;
}

hr.sep {
  border: none;
  border-top: 1px solid var(--line);
  margin: 12px 0;
}
.footnote {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}
@media (max-width: 1000px) {
  .grid {
    grid-template-columns: 1fr;
  }
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .wrap {
    margin: 20px auto;
  }
  .row {
    flex-direction: column;
  }
}

/* Make AI Tailor editor and preview columns independently scrollable */
.ai-tailor-section #rewritePanel {
  /* ensure the panel has room and doesn't expand the whole page */
  max-height: 82vh;
  overflow: hidden; /* inner columns scroll instead */
}
.ai-tailor-section #rewritePanel #optimizedInputsEditor {
  height: 640px;
  max-height: 78vh;
  overflow: auto;
}
.ai-tailor-section #rewritePanel .preview-wrap {
  height: 640px;
  max-height: 78vh;
  overflow: auto;
}
