/* ============================================================
   ProResume Builder – Stylesheet
   Fonts loaded via JS (avoids render-blocking)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Merriweather:ital,wght@0,400;0,700;1,400&family=DM+Sans:wght@400;500;700&family=Playfair+Display:wght@400;700&display=swap');

/* ── CSS CUSTOM PROPS ── */
:root {
  --prr-accent:    #2563eb;
  --prr-accent-lt: #dbeafe;
  --prr-bg:        #f8fafc;
  --prr-surface:   #ffffff;
  --prr-border:    #e2e8f0;
  --prr-text:      #0f172a;
  --prr-muted:     #64748b;
  --prr-radius:    10px;
  --prr-shadow:    0 4px 24px rgba(0,0,0,.08);
  --prr-font:      'Inter', sans-serif;
  --prr-bar-h:     64px;
}

/* ── RESET SCOPE ── */
#prr-app, #prr-app * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── WRAPPER ── */
#prr-app {
  font-family: var(--prr-font);
  color: var(--prr-text);
  background: var(--prr-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ════════════════════════════════════════
   TOP BAR
════════════════════════════════════════ */
.prr-topbar {
  height: var(--prr-bar-h);
  background: var(--prr-surface);
  border-bottom: 1px solid var(--prr-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}

.prr-topbar__left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.prr-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--prr-accent);
  white-space: nowrap;
  letter-spacing: -.5px;
}

.prr-title-input {
  border: 1px solid var(--prr-border);
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--prr-text);
  background: var(--prr-bg);
  width: 220px;
  transition: border-color .2s;
}
.prr-title-input:focus { outline: none; border-color: var(--prr-accent); }

.prr-topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ── BUTTONS ── */
.prr-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
}
.prr-btn--ghost {
  background: transparent;
  color: var(--prr-muted);
  border: 1px solid var(--prr-border);
}
.prr-btn--ghost:hover { background: var(--prr-bg); color: var(--prr-text); border-color: #94a3b8; }

.prr-btn--primary {
  background: var(--prr-accent);
  color: #fff;
}
.prr-btn--primary:hover { background: #1d4ed8; }

.prr-btn--add {
  background: var(--prr-accent-lt);
  color: var(--prr-accent);
  border: 1px dashed var(--prr-accent);
  width: 100%;
  justify-content: center;
  margin-top: 12px;
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
}
.prr-btn--add:hover { background: #bfdbfe; }

/* ════════════════════════════════════════
   LAYOUT
════════════════════════════════════════ */
.prr-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  flex: 1;
  overflow: hidden;
}

/* ════════════════════════════════════════
   LEFT PANEL
════════════════════════════════════════ */
.prr-panel {
  background: var(--prr-surface);
  border-right: 1px solid var(--prr-border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--prr-bar-h));
}

/* TABS */
.prr-tabs {
  display: flex;
  border-bottom: 1px solid var(--prr-border);
  overflow-x: auto;
  flex-shrink: 0;
}
.prr-tabs::-webkit-scrollbar { height: 0; }

.prr-tab {
  background: none;
  border: none;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--prr-muted);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all .18s;
  font-family: inherit;
}
.prr-tab:hover { color: var(--prr-text); }
.prr-tab--active {
  color: var(--prr-accent);
  border-bottom-color: var(--prr-accent);
  font-weight: 600;
}

/* TAB PANELS */
.prr-tab-panel { display: none; padding: 24px; flex: 1; }
.prr-tab-panel--active { display: block; }

/* FORM FIELDS */
.prr-field-group { margin-bottom: 16px; }
.prr-field-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--prr-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.prr-req { color: #ef4444; }
.prr-hint { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 11px; }

.prr-input, .prr-textarea, .prr-select {
  width: 100%;
  border: 1px solid var(--prr-border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--prr-text);
  background: var(--prr-bg);
  transition: border-color .2s, box-shadow .2s;
  appearance: none;
}
.prr-input:focus, .prr-textarea:focus, .prr-select:focus {
  outline: none;
  border-color: var(--prr-accent);
  box-shadow: 0 0 0 3px var(--prr-accent-lt);
}
.prr-textarea { resize: vertical; line-height: 1.6; }
.prr-color {
  height: 40px;
  width: 100%;
  border: 1px solid var(--prr-border);
  border-radius: 8px;
  padding: 4px 6px;
  cursor: pointer;
  background: var(--prr-bg);
}

.prr-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* TAGS (Skills / Languages) */
.prr-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  min-height: 32px;
}
.prr-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--prr-accent-lt);
  color: var(--prr-accent);
  font-size: 13px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
}
.prr-tag__remove {
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  opacity: .6;
  background: none;
  border: none;
  color: inherit;
  padding: 0;
}
.prr-tag__remove:hover { opacity: 1; }

/* ENTRY CARDS (Experience / Education) */
.prr-entry { background: var(--prr-bg); border: 1px solid var(--prr-border); border-radius: var(--prr-radius); margin-bottom: 12px; }
.prr-entry__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
}
.prr-entry__label { font-size: 14px; font-weight: 600; }
.prr-entry__toggle { font-size: 18px; color: var(--prr-muted); line-height: 1; }
.prr-entry__body { display: none; padding: 16px; border-top: 1px solid var(--prr-border); }
.prr-entry--open .prr-entry__body { display: block; }
.prr-entry__delete { background: none; border: none; cursor: pointer; color: #ef4444; font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 6px; }
.prr-entry__delete:hover { background: #fee2e2; }

/* STATUS */
.prr-status {
  padding: 14px 24px;
  font-size: 13px;
  color: #16a34a;
  font-weight: 500;
  min-height: 44px;
  flex-shrink: 0;
}

/* ════════════════════════════════════════
   RIGHT PANEL – LIVE PREVIEW
════════════════════════════════════════ */
.prr-preview-wrap {
  overflow-y: auto;
  background: #cbd5e1;
  padding: 40px;
  max-height: calc(100vh - var(--prr-bar-h));
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.prr-resume {
  background: #fff;
  width: 210mm;
  min-height: 297mm;
  box-shadow: var(--prr-shadow);
  border-radius: 4px;
  padding: 40px 48px;
  font-size: 13px;
  line-height: 1.6;
  color: #111;
  flex-shrink: 0;
}

.prr-empty-state {
  color: #94a3b8;
  text-align: center;
  padding: 60px 20px;
  font-size: 15px;
}

/* ── RESUME INTERNALS ── */
.prr-resume__header { margin-bottom: 28px; }
.prr-resume__header .prr-hdr-row {
  display: flex;
  gap: 24px;
  align-items: center;
}
.prr-resume__photo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 3px solid var(--prr-accent);
}
.prr-resume__name {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.5px;
}
.prr-resume__jobtitle {
  font-size: 15px;
  color: var(--prr-accent);
  font-weight: 600;
  margin-top: 4px;
}
.prr-resume__contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-top: 10px;
  font-size: 12px;
  color: #444;
}
.prr-resume__contacts a { color: inherit; text-decoration: none; }
.prr-resume__contacts a:hover { text-decoration: underline; }

.prr-divider {
  border: none;
  border-top: 2px solid var(--prr-accent);
  margin: 20px 0 16px;
}

.prr-section { margin-bottom: 24px; }
.prr-section__title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--prr-accent);
  margin-bottom: 12px;
}

/* Summary */
.prr-summary-text { font-size: 13px; color: #333; line-height: 1.75; }

/* Experience / Education entries */
.prr-entry-item { margin-bottom: 18px; }
.prr-entry-item:last-child { margin-bottom: 0; }
.prr-entry-item__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.prr-entry-item__role  { font-size: 14px; font-weight: 700; }
.prr-entry-item__dates { font-size: 11px; color: #64748b; white-space: nowrap; }
.prr-entry-item__org   { font-size: 13px; font-weight: 600; color: var(--prr-accent); margin-top: 2px; }
.prr-entry-item__loc   { font-size: 11px; color: #64748b; }
.prr-entry-item__desc  { font-size: 12.5px; color: #333; margin-top: 6px; line-height: 1.65; white-space: pre-wrap; }

/* Skills */
.prr-skills-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.prr-skill-tag {
  background: var(--prr-accent-lt);
  color: var(--prr-accent);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

/* Certs / Projects / Interests */
.prr-extras-text { font-size: 12.5px; color: #333; line-height: 1.75; white-space: pre-wrap; }

/* References */
.prr-refs { font-size: 12px; color: #64748b; font-style: italic; }

/* ═══════ TEMPLATE VARIANTS ═══════ */

/* ── MODERN ── */
.prr-tpl-modern .prr-resume__header {
  background: var(--prr-accent);
  color: #fff;
  margin: -40px -48px 28px;
  padding: 36px 48px 28px;
  border-radius: 4px 4px 0 0;
}
.prr-tpl-modern .prr-resume__name { color: #fff; }
.prr-tpl-modern .prr-resume__jobtitle { color: rgba(255,255,255,.85); }
.prr-tpl-modern .prr-resume__contacts { color: rgba(255,255,255,.8); }
.prr-tpl-modern .prr-resume__contacts a { color: #fff; }
.prr-tpl-modern .prr-divider { border-color: #e2e8f0; }
.prr-tpl-modern .prr-resume__photo { border-color: rgba(255,255,255,.5); }

/* ── MINIMAL ── */
.prr-tpl-minimal .prr-resume__name { font-size: 24px; letter-spacing: 0; }
.prr-tpl-minimal .prr-resume__jobtitle { color: #333; font-weight: 400; }
.prr-tpl-minimal .prr-divider { border-top: 1px solid #cbd5e1; }
.prr-tpl-minimal .prr-section__title { color: #0f172a; font-size: 9px; }
.prr-tpl-minimal .prr-skill-tag { background: #f1f5f9; color: #334155; }

/* ════════════════════════════════════════
   MODAL
════════════════════════════════════════ */
.prr-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 9999;
  overflow-y: auto;
  padding: 40px 20px;
}
.prr-modal--open { display: flex; align-items: flex-start; justify-content: center; }
.prr-modal__inner {
  background: #fff;
  border-radius: 12px;
  padding: 48px;
  max-width: 800px;
  width: 100%;
  position: relative;
}
.prr-modal__close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--prr-muted);
  border-radius: 6px;
  padding: 4px 8px;
}
.prr-modal__close:hover { background: var(--prr-bg); }

/* SELECT custom arrow */
.prr-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 900px) {
  .prr-layout { grid-template-columns: 1fr; }
  .prr-preview-wrap { display: none; }
  .prr-resume { width: 100%; min-height: unset; }
}

@media (max-width: 600px) {
  .prr-topbar { flex-wrap: wrap; height: auto; padding: 12px 16px; }
  .prr-title-input { width: 150px; }
  .prr-field-row { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════
   PRINT  (for PDF engine)
════════════════════════════════════════ */
@media print {
  #prr-app > *:not(#prr-resume-preview) { display: none !important; }
  .prr-resume { box-shadow: none; margin: 0; padding: 20mm; width: 100%; min-height: unset; }
}
