/* Resume Builder — chrome styles layered on Werk's design system (main.css).
   Loaded on the login, dashboard and editor pages (all extend base.html), so it
   only adds resume-specific pieces and otherwise reuses Werk's tokens, .container,
   .card, .btn, .form-* etc. The rendered résumé (preview iframe) is styled
   separately by its theme template. */

.muted { color: var(--color-text-light); }
.is-hidden { display: none !important; }

/* extra button variants (Werk already has .btn / .btn-primary / .btn-outline) */
.btn-ghost { background: var(--color-bg); color: var(--color-text); border-color: var(--color-border); }
.btn-ghost:hover { background: var(--color-bg-alt); }
.btn-danger { background: var(--color-bg); color: var(--color-danger); border-color: #f3c4c4; }
.btn-danger:hover { background: #fef2f2; }
.btn-tiny { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

/* ---- auth ---- */
.auth-section { padding-block: 2.5rem; }
.auth-split {
  max-width: 940px; margin-inline: auto;
  display: grid; grid-template-columns: 1fr 1fr;
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-md); min-height: 540px;
}
/* Branded panel — first impression that reads as a real product. */
.auth-hero {
  background: linear-gradient(150deg, var(--color-primary-dark), var(--color-primary));
  color: #fff; padding: 2.5rem; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem;
}
.auth-hero-brand { font-weight: 800; font-size: 1.2rem; letter-spacing: 0.01em; }
.auth-hero-copy h1 { color: #fff; font-size: 1.9rem; line-height: 1.15; margin: 0 0 0.6rem; }
.auth-hero-copy p { color: rgba(255, 255, 255, 0.85); margin: 0; }
.auth-hero-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.auth-hero-points li { position: relative; padding-left: 1.6rem; color: rgba(255, 255, 255, 0.92); font-size: 0.95rem; }
.auth-hero-points li::before { content: "\2713"; position: absolute; left: 0; font-weight: 700; }
.auth-panel { background: var(--color-bg); padding: 2.5rem; display: flex; align-items: center; }
.auth-card-inner { width: 100%; }
.auth-title { margin-bottom: 0.25rem; }
.auth-tabs { display: flex; gap: 0.5rem; margin: 1.25rem 0; }
@media (max-width: 720px) {
  .auth-split { grid-template-columns: 1fr; min-height: 0; max-width: 460px; }
  .auth-hero { display: none; }
  .auth-panel { padding: 1.75rem; }
}
.auth-tab {
  flex: 1; padding: 0.55rem; border: 1px solid var(--color-border);
  background: var(--color-bg); border-radius: var(--radius);
  font: inherit; font-weight: 600; color: var(--color-text-light); cursor: pointer;
}
.auth-tab.is-active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.auth-form { display: flex; flex-direction: column; }
.auth-error { color: var(--color-danger); min-height: 1.2em; margin: 0.75rem 0 0; text-align: center; }

/* ---- modal dialogs (styled alert/confirm/prompt — see modal.js) ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-card {
  background: var(--color-bg); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); border: 1px solid var(--color-border);
  width: 100%; max-width: 420px; padding: 1.5rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.modal-title { margin: 0; font-size: 1.05rem; }
.modal-msg { margin: 0; color: var(--color-text); white-space: pre-line; line-height: 1.5; }
.modal-input { width: 100%; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }
/* solid red for destructive confirm buttons (outline .btn-danger is too soft here) */
.btn-danger-solid { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn-danger-solid:hover { filter: brightness(0.92); color: #fff; }

/* ---- login: Google sign-in ---- */
.auth-divider {
  display: flex; align-items: center; gap: 0.75rem; margin: 1.25rem 0;
  color: var(--color-text-light); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em;
}
.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--color-border);
}
.btn-google { display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.btn-google:hover { text-decoration: none; }

/* ---- forgot / reset password pages ---- */
.auth-forgot-row { margin-top: 0.35rem; text-align: right; }
.auth-forgot { font-size: 0.82rem; color: var(--color-text-light); }
.auth-forgot:hover { color: var(--color-primary); }
.auth-narrow { max-width: 440px; margin-inline: auto; padding: 2rem; }
.auth-narrow .auth-title { margin-bottom: 0.35rem; }
.auth-narrow .auth-form { margin-top: 1.25rem; }
.auth-note { min-height: 1.2em; margin: 1rem 0 0; font-size: 0.9rem; }
.auth-back { margin: 1rem 0 0; font-size: 0.85rem; }

/* ---- account settings ---- */
.settings-wrap { max-width: 640px; }
.settings-card { margin-bottom: 1.25rem; }
.settings-hint { font-size: 0.85rem; margin: 0 0 0.9rem; }
.settings-form { display: flex; flex-direction: column; gap: 0.9rem; align-items: flex-start; }
.settings-form .form-group { width: 100%; margin: 0; }
.settings-note { font-size: 0.85rem; color: var(--color-text-light); }
.signin-methods { list-style: none; margin: 0 0 0.75rem; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.signin-methods li { display: flex; align-items: center; gap: 0.6rem; font-weight: 600; }
.signin-methods i { width: 1.1rem; text-align: center; color: var(--color-text-light); }
.method-badge {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem; border-radius: 999px;
  background: var(--color-bg-alt); color: var(--color-text-light); border: 1px solid var(--color-border);
}
.method-badge.is-on { background: #e8f5ee; color: #157347; border-color: #bfe3cf; }
.danger-zone { border-color: #f3c4c4; }
.danger-zone .card-title { color: var(--color-danger); }

/* ---- dashboard ---- */
.dash-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.dash-head h1 { margin-bottom: 0.15rem; }
.dash-head p { margin: 0; }
.dash-actions { display: flex; gap: 0.5rem; }
.resume-card {
  background: var(--color-bg); border: 1px solid var(--color-border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.resume-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
/* Live thumbnail: the real resume preview scaled down and clipped, so the card
   shows the user's actual work. Reuses the template-gallery iframe trick. */
.resume-thumb {
  display: block; height: 250px; position: relative; overflow: hidden;
  background: #fff; border-bottom: 1px solid var(--color-border);
}
.resume-thumb iframe {
  position: absolute; top: 0; left: 0; width: 820px; height: 1160px; border: 0;
  transform: scale(0.46); transform-origin: top left; pointer-events: none;
}
.resume-card-body { padding: 0.9rem 1.15rem 1.15rem; display: flex; flex-direction: column; gap: 0.4rem; }
.resume-card-title { margin: 0; font-size: 1.05rem; }
.resume-card-meta { margin: 0; font-size: 0.85rem; }
.resume-card-actions { margin-top: 0.35rem; display: flex; gap: 0.5rem; }

/* ---- editor: toolbar ---- */
.editor-toolbar {
  position: sticky; top: var(--navbar-height); z-index: 20;
  background: var(--color-bg); border-bottom: 1px solid var(--color-border);
}
.editor-toolbar-inner { display: flex; align-items: center; gap: 1rem; padding-block: 0.6rem; min-height: 56px; }
.editor-back { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; white-space: nowrap; }
.editor-back:hover { text-decoration: none; }
.title-input {
  flex: 1; min-width: 0; max-width: 520px;
  padding: 0.45rem 0.6rem; font: inherit; font-size: 1.05rem; font-weight: 600;
  border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--color-text);
}
.title-input:hover { border-color: var(--color-border); }
.title-input:focus { outline: none; border-color: var(--color-primary); background: var(--color-bg); }
.editor-toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.85rem; }
.save-status { font-size: 0.85rem; white-space: nowrap; }
.save-status.is-saving { color: var(--color-primary); }

/* ---- editor: split ---- */
.editor-split {
  display: grid; grid-template-columns: 1fr 1fr;
  height: calc(100vh - var(--navbar-height) - 57px);
}
.editor-pane { overflow-y: auto; padding: 1.25rem; background: var(--color-bg-alt); }
.preview-pane { overflow-y: auto; padding: 1.25rem; background: #e9edf2; border-left: 1px solid var(--color-border); }
#preview {
  width: 100%; height: 100%; min-height: 600px; border: 1px solid var(--color-border);
  border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-md);
}

/* ---- editor: cards / sections ---- */
.card-title { margin: 0 0 0.75rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-light); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; font-weight: 600; color: var(--color-text); }
.field input, .field textarea {
  padding: 0.45rem 0.6rem; border: 1px solid var(--color-border); border-radius: var(--radius);
  font: inherit; font-size: 0.9rem; font-weight: 400; color: var(--color-text); background: var(--color-bg);
}
.field textarea { resize: vertical; }

/* contact photo control (spans the full width of the 2-col contact grid) */
.contact-photo-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.contact-photo {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--color-border); background: var(--color-bg-alt);
}

.sections-list { margin-top: 1.25rem; display: flex; flex-direction: column; }
.section-card { margin-bottom: 1rem; }
.section-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.drag-handle { cursor: grab; color: var(--color-text-light); font-size: 1.1rem; user-select: none; }
.section-type-tag {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--color-primary-dark); background: var(--color-primary-light);
  border-radius: var(--radius); padding: 0.2rem 0.5rem; white-space: nowrap;
}
.section-heading {
  flex: 1; min-width: 0; padding: 0.4rem 0.6rem; border: 1px solid var(--color-border);
  border-radius: var(--radius); font: inherit; font-weight: 600;
}
.section-head .btn-danger { margin-left: auto; }
.section-body { display: flex; flex-direction: column; gap: 0.75rem; }

.items { display: flex; flex-direction: column; gap: 0.75rem; }
.item-edit { border: 1px dashed var(--color-border); border-radius: var(--radius); padding: 0.75rem; display: flex; flex-direction: column; gap: 0.6rem; }
.item-edit-head { display: flex; align-items: center; justify-content: space-between; }
.btn-add-item { align-self: flex-start; }

.add-section { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
.add-section .form-select { max-width: 220px; }

.sortable-ghost { opacity: 0.45; }
.sortable-chosen { box-shadow: 0 0 0 2px var(--color-primary); }

/* ---- editor: AI assist (opt-in, clearly separated from the content fields) ---- */
.ai-panel { border-top: 1px dashed var(--color-border); margin-top: 0.4rem; padding-top: 0.6rem; }
.ai-toggle { color: var(--color-primary); }
.ai-body {
  display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.6rem; padding: 0.75rem;
  border: 1px solid #cdddf6; background: var(--color-primary-light); border-radius: var(--radius);
}
.ai-hint { font-size: 0.75rem; line-height: 1.35; margin: 0; }
.ai-body input, .ai-body textarea {
  padding: 0.45rem 0.6rem; border: 1px solid var(--color-border); border-radius: var(--radius); font: inherit; font-size: 0.9rem;
}
.ai-actions { display: flex; align-items: center; gap: 0.6rem; }
.ai-note { font-size: 0.8rem; }

/* ---- editor: AI coach (whole-CV review) + rewrite suggestions ---- */
.ai-coach { margin-top: 1rem; }
.ai-coach-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.ai-coach-head .card-title { margin-bottom: 0; }
.ai-coach-hint { font-size: 0.8rem; margin: 0.5rem 0 0; }
.ai-tips { list-style: none; margin: 0.75rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.ai-tip {
  display: flex; gap: 0.6rem; align-items: baseline; font-size: 0.85rem; line-height: 1.45;
  padding: 0.5rem 0.65rem; background: var(--color-bg);
  border: 1px solid var(--color-border); border-left-width: 3px; border-radius: var(--radius);
}
.ai-tip.sev-high { border-left-color: var(--color-danger); }
.ai-tip.sev-medium { border-left-color: #d97706; }
.ai-tip.sev-low { border-left-color: var(--color-primary); }
.ai-tip-area {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--color-text-light); white-space: nowrap;
}
.ai-tip-src { font-size: 0.75rem; }

.ai-suggest {
  margin-top: 0.6rem; padding: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem;
  border: 1px solid #cdddf6; background: var(--color-primary-light); border-radius: var(--radius);
}
.ai-suggest-head {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--color-text-light);
}
.ai-suggest-body { display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.85rem; }
.ai-suggest-text { margin: 0; }
.ai-suggest-list { margin: 0.15rem 0 0; padding-left: 1.1rem; }
.ai-suggest-list li { margin-bottom: 0.2rem; }
.ai-suggest-item .muted { font-size: 0.7rem; }

/* ---- template gallery (presentation before starting) ---- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.tpl-card {
  border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden;
  background: var(--color-bg); box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.tpl-preview {
  height: 360px; overflow: hidden; position: relative;
  border-bottom: 1px solid var(--color-border); background: #fff;
}
/* a real rendered sample, scaled down to a thumbnail */
.tpl-preview iframe {
  position: absolute; top: 0; left: 0; width: 900px; height: 1200px; border: 0;
  transform: scale(0.4); transform-origin: top left; pointer-events: none;
}
.tpl-meta { padding: 1rem; display: flex; flex-direction: column; gap: 0.35rem; }
.tpl-meta h3 { margin: 0; }
.tpl-use { margin-top: 0.6rem; align-self: flex-start; }

/* ---- editor template switcher ---- */
.tpl-switch-label { font-size: 0.85rem; white-space: nowrap; }
.tpl-switcher { width: auto; max-width: 160px; padding-block: 0.35rem; }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .editor-split { grid-template-columns: 1fr; height: auto; }
  .preview-pane { border-left: 0; border-top: 1px solid var(--color-border); }
  #preview { min-height: 70vh; }
  .field-grid { grid-template-columns: 1fr; }
}

/* On phones the toolbar can't fit in one row — let it wrap so Export PDF stays
   on-screen instead of forcing a horizontal scroll. Row 1: back + title;
   row 2: template switcher, save status and Export PDF. */
@media (max-width: 720px) {
  .editor-toolbar-inner { flex-wrap: wrap; row-gap: 0.5rem; }
  .title-input { max-width: none; }
  .editor-toolbar-right { margin-left: 0; width: 100%; flex-wrap: wrap; gap: 0.5rem 0.75rem; }
  .tpl-switcher { max-width: none; flex: 1 1 130px; }
  #export-pdf { margin-left: auto; }
  .add-section { flex-wrap: wrap; }
  .add-section .form-select { max-width: none; flex: 1 1 160px; }
}
