/* ══════════════════════════════════════════
   Resume Builder Pro — style.css v3.0
══════════════════════════════════════════ */
:root {
  --rbp-accent: #2563EB;
  --rbp-dark:   #1E293B;
  --rbp-gray:   #64748B;
  --rbp-light:  #F1F5F9;
  --rbp-border: #E2E8F0;
  --rbp-white:  #FFFFFF;
  --rbp-radius: 10px;
  --rbp-shadow: 0 4px 24px rgba(0,0,0,0.10);
}

/* ── App Shell ── */
.rbp-app {
  font-family: 'Roboto', sans-serif;
  color: var(--rbp-dark);
  max-width: 1600px;
  margin: 0 auto;
  /* Isolate plugin from page styles — prevent bleeding into WP page */
  contain: layout style;
  box-sizing: border-box;
}

/* ══ GALLERY SCREEN ══ */
.rbp-gallery-header { text-align: center; padding: 40px 20px 24px; }
.rbp-gallery-header h1 { font-size: 28px; font-weight: 700; margin: 0 0 8px; color: var(--rbp-dark); }
.rbp-gallery-header p { color: var(--rbp-gray); font-size: 15px; margin: 0 0 20px; }

.rbp-gallery-filter { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.rbp-filter-btn { padding: 7px 18px; border-radius: 20px; border: 1.5px solid var(--rbp-border); background: #fff; color: var(--rbp-gray); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.rbp-filter-btn.active, .rbp-filter-btn:hover { background: var(--rbp-accent); color: #fff; border-color: var(--rbp-accent); }

.rbp-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 20px; padding: 24px 20px 40px; }

.rbp-tpl-card { border-radius: var(--rbp-radius); overflow: hidden; border: 2px solid transparent; cursor: pointer; transition: all 0.2s; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,0.07); }
.rbp-tpl-card:hover { border-color: var(--rbp-accent); transform: translateY(-3px); box-shadow: 0 8px 28px rgba(37,99,235,0.18); }
.rbp-tpl-card.selected { border-color: var(--rbp-accent); }

.rbp-tpl-preview { position: relative; height: 240px; overflow: hidden; background: #f8fafc; }
.rbp-tpl-hover { position: absolute; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s; }
.rbp-tpl-card:hover .rbp-tpl-hover { opacity: 1; }
.rbp-use-btn { background: #fff; color: var(--rbp-accent); font-weight: 700; font-size: 13px; padding: 10px 20px; border: none; border-radius: 6px; cursor: pointer; transition: all 0.15s; }
.rbp-use-btn:hover { background: var(--rbp-accent); color: #fff; }

.rbp-tpl-thumb { width: 100%; height: 100%; }
.rbp-tpl-thumb svg { width: 100%; height: 100%; display: block; }

.rbp-tpl-info { padding: 10px 12px; border-top: 1px solid var(--rbp-border); }
.rbp-tpl-name { font-size: 13px; font-weight: 600; color: var(--rbp-dark); }

/* ══ BUILDER SCREEN ══ */
.rbp-builder-header { display: flex; align-items: center; gap: 16px; padding: 14px 20px; background: #fff; border-bottom: 1px solid var(--rbp-border); position: sticky; top: 0; z-index: 100; }
.rbp-back-btn { background: none; border: 1.5px solid var(--rbp-border); border-radius: 8px; padding: 8px 14px; font-size: 13px; cursor: pointer; color: var(--rbp-gray); transition: all 0.2s; }
.rbp-back-btn:hover { border-color: var(--rbp-accent); color: var(--rbp-accent); }
.rbp-builder-title { flex: 1; font-size: 16px; font-weight: 600; color: var(--rbp-dark); }
.rbp-builder-actions { display: flex; gap: 10px; }
.rbp-btn-secondary { padding: 9px 18px; border: 1.5px solid var(--rbp-accent); background: #fff; color: var(--rbp-accent); border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.rbp-btn-secondary:hover { background: var(--rbp-accent); color: #fff; }
.rbp-btn-primary { padding: 9px 18px; background: var(--rbp-accent); color: #fff; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.rbp-btn-primary:hover { background: #1D4ED8; }
.rbp-btn-download { width: 100%; padding: 13px; background: #16A34A; color: #fff; border: none; border-radius: 8px; font-size: 14px; font-weight: 700; cursor: pointer; transition: background 0.2s; }
.rbp-btn-download:hover { background: #15803D; }

/* Customization Bar — fixed single row */
.rbp-customize-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  padding: 0 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--rbp-border);
  overflow-x: auto;
  min-height: 52px;
  -webkit-overflow-scrolling: touch;
}
.rbp-customize-bar::-webkit-scrollbar { height: 3px; }
.rbp-customize-bar::-webkit-scrollbar-thumb { background: var(--rbp-border); border-radius: 2px; }

.rbp-cust-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-right: 1px solid var(--rbp-border);
  white-space: nowrap;
  flex-shrink: 0;
}
.rbp-cust-group:last-child { border-right: none; }
.rbp-cust-group > label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--rbp-gray); white-space: nowrap;
}
.rbp-color-swatches { display: flex; gap: 5px; align-items: center; flex-shrink: 0; }
.rbp-swatch {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  min-height: 22px !important;
  border-radius: 50% !important;
  border: 2px solid transparent !important;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  padding: 0 !important;
  display: inline-block !important;
  box-sizing: border-box !important;
}
.rbp-swatch.active, .rbp-swatch:hover {
  border-color: #fff !important;
  box-shadow: 0 0 0 2px var(--rbp-accent) !important;
  transform: scale(1.12);
}
.rbp-custom-color {
  width: 22px; height: 22px; border-radius: 50%;
  background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  border: 2px solid #ddd; position: relative; overflow: hidden; flex-shrink: 0;
}
.rbp-custom-color input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.rbp-custom-color span { color: #fff; font-weight: 700; font-size: 13px; text-shadow: 0 1px 2px rgba(0,0,0,0.6); pointer-events: none; }
.rbp-select {
  padding: 6px 8px; border: 1.5px solid var(--rbp-border);
  border-radius: 7px; font-size: 12px; background: #fff; cursor: pointer; max-width: 130px;
}
.rbp-select:focus { outline: none; border-color: var(--rbp-accent); }
.rbp-size-btns { display: flex; gap: 3px; }
.rbp-size-btn {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  border: 1.5px solid var(--rbp-border) !important;
  border-radius: 6px !important;
  background: #fff !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  color: var(--rbp-dark) !important;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  text-indent: 0 !important;
  visibility: visible !important;
  opacity: 1 !important;
}
.rbp-size-btn.active, .rbp-size-btn:hover { background: var(--rbp-accent) !important; color: #fff !important; border-color: var(--rbp-accent) !important; }

/* Builder Body */
.rbp-builder-body {
  display: flex;
  gap: 0;
  height: calc(100vh - 108px); /* header(52) + customize-bar(56) */
  overflow: hidden;
}

/* ── Form Panel — PROPER SCROLL FIX ── */
.rbp-form-panel {
  width: 360px;
  min-width: 320px;
  max-width: 360px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--rbp-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}
.rbp-tabs {
  display: flex;
  border-bottom: 1px solid var(--rbp-border);
  background: #f8fafc;
  flex-shrink: 0;
}
.rbp-tab { flex: 1; padding: 11px 4px; font-size: 11px; font-weight: 600; color: var(--rbp-gray); background: none; border: none; border-bottom: 3px solid transparent; cursor: pointer; transition: all 0.2s; white-space: nowrap; }
.rbp-tab.active { color: var(--rbp-accent); border-bottom-color: var(--rbp-accent); background: #fff; }
.rbp-tab:hover:not(.active) { color: var(--rbp-dark); }

/* THE KEY SCROLL FIX — tab content scrolls independently */
.rbp-tab-content {
  display: none;
  padding: 14px 16px;
  overflow-y: scroll;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;          /* critical for flex scroll */
  -webkit-overflow-scrolling: touch;
}
.rbp-tab-content.active {
  display: flex;
  flex-direction: column;
}

/* form inside tab content fills and scrolls */
#rbp-form { display: contents; }

/* Form Fields */
.rbp-field-group { margin-bottom: 14px; }
.rbp-field-group label { display: block; font-size: 12px; font-weight: 600; color: var(--rbp-dark); margin-bottom: 5px; }
.rbp-hint-inline { font-weight: 400; color: var(--rbp-gray); font-size: 11px; }
.rbp-field-group input, .rbp-field-group textarea, .rbp-field-group select {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--rbp-border); border-radius: 8px;
  font-size: 13px; background: #f8fafc; box-sizing: border-box; transition: border 0.2s; font-family: inherit;
}
.rbp-field-group input:focus, .rbp-field-group textarea:focus { border-color: var(--rbp-accent); outline: none; background: #fff; }
.rbp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Photo Upload */
.rbp-photo-section { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; padding: 14px; background: var(--rbp-light); border-radius: 10px; }
.rbp-photo-preview-wrap { width: 72px; height: 72px; border-radius: 50%; overflow: hidden; border: 3px solid var(--rbp-accent); flex-shrink: 0; position: relative; background: #e2e8f0; display: flex; align-items: center; justify-content: center; }
#rbp-photo-preview { width: 100%; height: 100%; object-fit: cover; display: none; }
.rbp-photo-placeholder { text-align: center; font-size: 11px; color: var(--rbp-gray); line-height: 1.3; }
.rbp-file-label { display: inline-block; padding: 7px 14px; background: var(--rbp-accent); color: #fff; border-radius: 7px; font-size: 12px; font-weight: 600; cursor: pointer; }
#rbp-photo-input { display: none; }
.rbp-hint { font-size: 11px; color: var(--rbp-gray); margin-top: 5px; }

/* Repeater */
.rbp-section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.rbp-section-header h3 { font-size: 14px; font-weight: 700; color: var(--rbp-dark); margin: 0; }
.rbp-add-btn { padding: 7px 14px; background: #EFF6FF; color: var(--rbp-accent); border: 1.5px dashed var(--rbp-accent); border-radius: 7px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.rbp-add-btn:hover { background: var(--rbp-accent); color: #fff; border-style: solid; }
.rbp-rep-card { background: #f8fafc; border: 1.5px solid var(--rbp-border); border-radius: 10px; padding: 14px; margin-bottom: 10px; }
.rbp-rep-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.rbp-rep-card-header span { font-size: 12px; font-weight: 700; color: var(--rbp-accent); }
.rbp-rep-card input, .rbp-rep-card textarea { width: 100%; padding: 8px 10px; border: 1.5px solid var(--rbp-border); border-radius: 7px; font-size: 13px; background: #fff; box-sizing: border-box; margin-bottom: 8px; font-family: inherit; }
.rbp-rep-card input:focus, .rbp-rep-card textarea:focus { border-color: var(--rbp-accent); outline: none; }
.rbp-del-btn { background: #FEF2F2; color: #DC2626; border: 1px solid #FECACA; border-radius: 6px; padding: 4px 10px; font-size: 11px; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.rbp-del-btn:hover { background: #DC2626; color: #fff; }

/* Tags preview */
.rbp-tag-preview { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.rbp-tag-prev-item { background: var(--rbp-accent); color: #fff; padding: 3px 10px; border-radius: 20px; font-size: 11px; }

/* Msg */
#rbp-msg { padding: 10px 16px; font-size: 13px; font-weight: 600; }

/* ── Preview Panel ── */
.rbp-preview-panel { flex: 1; display: flex; flex-direction: column; background: #d1d5db; overflow: hidden; min-width: 0; }
.rbp-preview-header {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: #fff;
  border-bottom: 1px solid var(--rbp-border);
  font-size: 13px;
  font-weight: 600;
  color: var(--rbp-dark);
  flex-shrink: 0;
  gap: 10px;
}
.rbp-zoom-btns { display: flex !important; align-items: center; gap: 8px; }
.rbp-zoom-btn {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  border: 1.5px solid var(--rbp-border) !important;
  border-radius: 6px !important;
  background: #fff !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  cursor: pointer;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.15s;
  padding: 0 !important;
  line-height: 1 !important;
  color: var(--rbp-dark) !important;
  flex-shrink: 0;
}
.rbp-zoom-btn:hover { background: var(--rbp-accent) !important; color: #fff !important; border-color: var(--rbp-accent) !important; }
#rbp-zoom-label { font-size: 12px; color: var(--rbp-gray); min-width: 42px; text-align: center; font-weight: 600; }

/* Preview scroll area */
.rbp-preview-wrap {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px;
  gap: 12px;                /* gap between pages */
}

.rbp-preview-footer { padding: 10px 16px; background: #fff; border-top: 1px solid var(--rbp-border); flex-shrink: 0; }

/* ══ RESUME PAGE (A4 sheet) ══
   Each page is exactly 794×1123px (A4 at 96dpi).
   Preview scales it to fit the panel width.
   DO NOT set height on .rbp-resume-paper — JS creates
   multiple .rbp-page divs for multi-page support.        */
.rbp-resume-paper {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: transparent;
  --rc: #2563EB;
  transform-origin: top center;
  transition: transform 0.2s;
}

/* Individual A4 page */
.rbp-page {
  background: #fff;
  width: 794px;
  height: 1123px;
  min-height: 1123px;
  max-height: 1123px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.18);
  border-radius: 2px;
  overflow: hidden;
  position: relative;      /* needed for absolute children */
  flex-shrink: 0;
  --rc: inherit;
}

.rbp-bg-fill {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none; z-index: 0; overflow: hidden;
}
.rbp-bg-fill > div { height: 100% !important; width: 100% !important; }

/* rbp-co = content-only layer — transparent bg, let template CSS handle layout */
.rbp-co {
  width: 794px !important;
  height: auto !important;
  min-height: 1123px;
  overflow: visible !important;
  display: flex !important;
  flex-direction: column !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  transform: none !important;
}
/* DO NOT override r-body flex — sidebar templates need flex:1 + align-items:stretch */
.rbp-co .r-sidebar, .rbp-co .r-side {
  background: transparent !important;
  min-height: 1123px;
}

/* r-body fills remaining page height after header */
.r-body {
  display: flex;
  flex: 1;
  align-items: stretch;
  min-height: 0;
  overflow: hidden;
}

/* Sidebars fill full body height */
.r-sidebar {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  flex-shrink: 0;
}

/* Side columns (right side) fill full body height */
.r-side {
  align-self: stretch;
  flex-shrink: 0;
}

/* Main content column */
.r-main {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* Font Sizes */
.rbp-page.font-small  { font-size: 11px; }
.rbp-page.font-medium { font-size: 13px; }
.rbp-page.font-large  { font-size: 15px; }

/* Spacing */
.rbp-page.spacing-compact  .r-section { margin-bottom: 10px; }
.rbp-page.spacing-normal   .r-section { margin-bottom: 16px; }
.rbp-page.spacing-relaxed  .r-section { margin-bottom: 24px; }

/* ══ SHARED RESUME ELEMENTS ══ */
.r-name { font-weight: 700; margin: 0 0 4px; line-height: 1.2; }
.r-title { margin: 0 0 10px; opacity: 0.85; }
.r-contacts { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11px; margin-top: 6px; }

/* Each contact pill: dot + text stays together, never splits */
.r-contact-item {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  white-space: nowrap !important;
  flex-shrink: 0;
}

/* Universal dot — class-based, beats any template span{display:block} */
.r-dot {
  display: inline-block !important;
  width: 5px !important;
  height: 5px !important;
  min-width: 5px !important;
  min-height: 5px !important;
  border-radius: 50% !important;
  background: currentColor !important;
  flex-shrink: 0 !important;
  align-self: center !important;
}

/* Sidebar row: dot fixed left, long text wraps on right */
.r-sb-row {
  display: flex !important;
  align-items: flex-start !important;
  gap: 6px !important;
  margin: 3px 0 !important;
  font-size: 11px;
  line-height: 1.5;
}
.r-sb-row > span:not(.r-dot) {
  flex: 1 !important;
  min-width: 0 !important;
  display: block !important;
  word-break: break-word;
  overflow-wrap: break-word;
}
.r-sec-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; color: var(--rc); border-bottom: 2px solid var(--rc); padding-bottom: 4px; margin: 0 0 10px; }
/* Ensure section title text never disappears on white bg */
.rbp-content-only .r-sec-title { color: var(--rc) !important; border-bottom-color: var(--rc) !important; }
.r-section { margin-bottom: 16px; }
.r-exp-item, .r-edu-item { margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px dashed #e2e8f0; }
.r-exp-item:last-child, .r-edu-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.r-exp-role { font-weight: 700; color: var(--rc); display: block; font-size: 1.05em; }
.r-exp-meta { font-size: 0.88em; color: #888; margin: 2px 0 5px; }
.r-exp-desc { font-size: 0.95em; color: #555; line-height: 1.6; }
.r-skill-tag { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.85em; margin: 2px; font-weight: 600; background: var(--rc); color: #fff; }
.r-lang-item { font-size: 0.9em; color: #444; padding: 2px 0; }
.r-cert-item { font-size: 0.9em; color: #555; padding: 2px 0; border-left: 3px solid var(--rc); padding-left: 8px; margin-bottom: 5px; }
.r-photo { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 3px solid rgba(255,255,255,0.5); flex-shrink: 0; }

/* ══ TEMPLATE: CONTEMPORARY ══ */
.template-contemporary .r-header { background: var(--rc); color: #fff; padding: 28px 30px; display: flex; gap: 20px; align-items: center; }
.template-contemporary .r-name { font-size: 26px; color: #fff; }
.template-contemporary .r-title { color: rgba(255,255,255,0.85); font-size: 14px; }
.template-contemporary .r-contacts { color: rgba(255,255,255,0.9); }
.template-contemporary .r-contacts .r-contact-item { background: rgba(255,255,255,0.15); padding: 2px 8px; border-radius: 12px; }
.template-contemporary .r-contacts .r-dot { background: rgba(255,255,255,0.9) !important; }
.template-contemporary .r-body { display: flex; }
.template-contemporary .r-main { flex: 2; padding: 24px 28px; border-right: 2px solid #f1f5f9; }
.template-contemporary .r-side { flex: 1; padding: 24px 20px; background: #f8fafc; }

/* ══ TEMPLATE: CURRENT ══ */
.template-current .r-header { background: var(--rc); color: #fff; padding: 30px 35px; }
.template-current .r-name { font-size: 28px; color: #fff; font-weight: 800; }
.template-current .r-title { background: rgba(255,255,255,0.15); display: inline-block; padding: 4px 14px; border-radius: 4px; color: #fff; margin-top: 5px; }
.template-current .r-contacts { color: rgba(255,255,255,0.85); margin-top: 10px; }
.template-current .r-body { display: flex; }
.template-current .r-main { flex: 1; padding: 26px 30px; }
.template-current .r-side { width: 220px; padding: 22px 18px; border-left: 4px solid var(--rc); }
.template-current .r-sec-title { color: var(--rc); border-bottom-color: var(--rc); }

/* ══ TEMPLATE: INNOVATIVE ══ */
.template-innovative .r-body { display: flex; align-items: stretch; }
.template-innovative .r-sidebar { width: 260px; background: var(--rc); color: #fff; padding: 30px 20px; display: flex; flex-direction: column; align-self: stretch; }
.template-innovative .r-header { text-align: center; padding-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,0.2); margin-bottom: 20px; display: flex; flex-direction: column; align-items: center; }
.template-innovative .r-photo { margin: 0 auto 14px; border: 4px solid rgba(255,255,255,0.4); display: block; flex-shrink: 0; }
.template-innovative .r-name { font-size: 20px; color: #fff; text-align: center; display: block; width: 100%; word-break: break-word; }
.template-innovative .r-title { color: rgba(255,255,255,0.75); text-align: center; font-size: 12px; display: block; width: 100%; word-break: break-word; margin-top: 4px; }
.template-innovative .r-sb-sec h3 { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(255,255,255,0.5); border-bottom: 1px solid rgba(255,255,255,0.15); padding-bottom: 4px; margin-bottom: 8px; }
.template-innovative .r-sb-sec { margin-bottom: 18px; }
.template-innovative .r-sb-sec p, .template-innovative .r-sb-sec span { font-size: 11px; color: rgba(255,255,255,0.85); display: block; margin: 3px 0; }
.template-innovative .r-main { flex: 1; padding: 30px 26px; }
.template-innovative .r-sec-title { color: var(--rc); border-bottom-color: var(--rc); }
.template-innovative .r-skill-tag { background: rgba(255,255,255,0.2); }

/* ══ TEMPLATE: BASIC ══ */
.template-basic .r-header { padding: 30px 35px; border-bottom: 3px solid var(--rc); }
.template-basic .r-name { font-size: 28px; color: var(--rc); }
.template-basic .r-title { color: #555; font-size: 15px; }
.template-basic .r-contacts { color: #666; font-size: 12px; }
.template-basic .r-body { display: flex; align-items: stretch; }
.template-basic .r-main { flex: 2; padding: 24px 30px; }
.template-basic .r-side { flex: 1; padding: 24px 20px; background: var(--rc); align-self: stretch; }
.template-basic .r-side .r-sec-title { color: #fff; border-bottom-color: rgba(255,255,255,0.3); }
.template-basic .r-side .r-exp-role { color: #fff; }
.template-basic .r-side .r-exp-meta, .template-basic .r-side .r-exp-desc, .template-basic .r-side .r-lang-item { color: rgba(255,255,255,0.85); }
.template-basic .r-side .r-skill-tag { background: rgba(255,255,255,0.2); color: #fff; }

/* ══ TEMPLATE: POLISHED ══ */
.template-polished .r-header { background: #fff; padding: 30px 36px 20px; border-top: 5px solid var(--rc); }
.template-polished .r-name { font-size: 28px; color: #1e293b; font-weight: 800; }
.template-polished .r-title { color: var(--rc); font-size: 14px; font-weight: 600; }
.template-polished .r-contacts { color: #555; font-size: 12px; border-top: 1px solid #e2e8f0; padding-top: 10px; margin-top: 8px; }
.template-polished .r-body { display: flex; }
.template-polished .r-main { flex: 2; padding: 24px 28px; }
.template-polished .r-side { flex: 1; padding: 24px 20px; background: #f8fafc; border-left: 3px solid var(--rc); }

/* ══ TEMPLATE: MINIMALIST ══ */
.template-minimalist .r-header { padding: 40px 40px 24px; }
.template-minimalist .r-name { font-size: 32px; color: #111; font-weight: 300; letter-spacing: -1px; }
.template-minimalist .r-title { color: var(--rc); font-size: 14px; font-weight: 500; }
.template-minimalist .r-contacts { color: #888; font-size: 11px; }
.template-minimalist .r-body { display: flex; }
.template-minimalist .r-main { flex: 2; padding: 24px 36px; }
.template-minimalist .r-side { flex: 1; padding: 24px 24px; border-left: 1px solid #f1f5f9; }
.template-minimalist .r-sec-title { border-bottom: 1px solid var(--rc); font-weight: 600; }
.template-minimalist .r-skill-tag { background: transparent; color: var(--rc); border: 1px solid var(--rc); }

/* ══ TEMPLATE: DYNAMIC ══ */
.template-dynamic .r-body { display: flex; align-items: stretch; }
.template-dynamic .r-sidebar { width: 240px; background: #1e293b; color: #fff; padding: 0; display: flex; flex-direction: column; align-self: stretch; }
.template-dynamic .r-header {
  padding: 30px 20px;
  background: var(--rc);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.template-dynamic .r-photo { margin: 0 auto 12px; display: block; flex-shrink: 0; }
.template-dynamic .r-name { font-size: 18px; color: #fff; text-align: center; display: block; width: 100%; word-break: break-word; }
.template-dynamic .r-title { color: rgba(255,255,255,0.8); text-align: center; font-size: 12px; display: block; width: 100%; word-break: break-word; margin-top: 4px; }
.template-dynamic .r-sb-sec { padding: 16px 18px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.template-dynamic .r-sb-sec h3 { font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--rc); margin-bottom: 8px; }
.template-dynamic .r-sb-sec p, .template-dynamic .r-sb-sec span { font-size: 11px; color: rgba(255,255,255,0.8); display: block; margin: 3px 0; }
.template-dynamic .r-main { flex: 1; padding: 28px 24px; }
.template-dynamic .r-skill-tag { background: rgba(255,255,255,0.15); }

/* ══ TEMPLATE: IMAGINATIVE ══ */
.template-imaginative .r-header { background: #fff; padding: 24px 30px; display: flex; align-items: center; gap: 20px; border-left: 8px solid var(--rc); }
.template-imaginative .r-name { font-size: 24px; color: var(--rc); font-weight: 800; }
.template-imaginative .r-title { color: #555; }
.template-imaginative .r-photo { border: 3px solid var(--rc); }
.template-imaginative .r-body { display: flex; align-items: stretch; }
.template-imaginative .r-main { flex: 2; padding: 22px 28px; }
.template-imaginative .r-side { flex: 1; padding: 22px 18px; background: var(--rc); align-self: stretch; }
.template-imaginative .r-side .r-sec-title { color: #fff; border-bottom-color: rgba(255,255,255,0.4); }
.template-imaginative .r-side .r-exp-role { color: #fff; }
.template-imaginative .r-side .r-exp-meta, .template-imaginative .r-side p, .template-imaginative .r-side .r-lang-item { color: rgba(255,255,255,0.88); }
.template-imaginative .r-side .r-skill-tag { background: rgba(255,255,255,0.2); }

/* ══ TEMPLATE: BOLD ══ */
.template-bold .r-header { background: var(--rc); padding: 35px; display: flex; gap: 22px; align-items: center; }
.template-bold .r-name { font-size: 32px; color: #fff; font-weight: 900; letter-spacing: -0.5px; }
.template-bold .r-title { color: rgba(255,255,255,0.85); font-size: 15px; }
.template-bold .r-contacts { color: rgba(255,255,255,0.85); }
.template-bold .r-contacts .r-contact-item { background: rgba(0,0,0,0.2); padding: 3px 10px; border-radius: 20px; }
.template-bold .r-contacts .r-dot { background: rgba(255,255,255,0.85) !important; }
.template-bold .r-body { display: flex; }
.template-bold .r-main { flex: 2; padding: 28px 30px; border-right: 3px solid var(--rc); }
.template-bold .r-side { flex: 1; padding: 28px 22px; background: #f8fafc; }
.template-bold .r-sec-title { font-size: 13px; }

/* ══ TEMPLATE: ORIGINAL ══ */
.template-original .r-header { background: var(--rc); color: #fff; padding: 28px 32px; }
.template-original .r-name { font-size: 26px; color: #fff; }
.template-original .r-title { color: rgba(255,255,255,0.8); }
.template-original .r-body { padding: 24px 32px; }
.template-original .r-body .r-main { padding: 0; }
.template-original .r-body .r-side { display: none; }
.template-original .r-contacts { color: rgba(255,255,255,0.9); }

/* ══ TEMPLATE: CLASSIC ══ */
.template-classic .r-header { background: var(--rc); color: #fff; padding: 30px; display: flex; gap: 20px; align-items: center; }
.template-classic .r-name { font-size: 24px; color: #fff; }
.template-classic .r-title { color: rgba(255,255,255,0.85); }
.template-classic .r-body { display: flex; }
.template-classic .r-main { flex: 2; padding: 24px 28px; }
.template-classic .r-side { flex: 1; padding: 24px 20px; background: #f8fafc; }

/* ══ TEMPLATE: MODERN ══ */
.template-modern .r-body { display: flex; align-items: stretch; }
.template-modern .r-sidebar { width: 280px; background: var(--rc); padding: 30px 22px; color: #fff; display: flex; flex-direction: column; align-self: stretch; }
.template-modern .r-header { text-align: center; margin-bottom: 24px; display: flex; flex-direction: column; align-items: center; }
.template-modern .r-photo { margin: 0 auto 14px; border-color: rgba(255,255,255,0.4); display: block; flex-shrink: 0; }
.template-modern .r-name { font-size: 20px; color: #fff; display: block; width: 100%; word-break: break-word; text-align: center; }
.template-modern .r-title { color: rgba(255,255,255,0.75); font-size: 12px; display: block; width: 100%; word-break: break-word; text-align: center; margin-top: 4px; }
.template-modern .r-sb-sec { margin-bottom: 18px; }
.template-modern .r-sb-sec h3 { font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(255,255,255,0.5); border-bottom: 1px solid rgba(255,255,255,0.15); padding-bottom: 4px; margin-bottom: 8px; }
.template-modern .r-sb-sec p, .template-modern .r-sb-sec span { font-size: 11px; color: rgba(255,255,255,0.85); display: block; margin: 3px 0; }
.template-modern .r-main { flex: 1; padding: 30px 26px; }
.template-modern .r-skill-tag { background: rgba(255,255,255,0.2); }

/* ══ TEMPLATE: EXECUTIVE ══ */
.template-executive .r-header { padding: 28px 40px; border-top: 6px solid var(--rc); border-bottom: 1px solid #e2e8f0; display: flex; gap: 20px; align-items: center; }
.template-executive .r-name { font-size: 26px; color: var(--rc); }
.template-executive .r-title { color: #666; font-style: italic; }
.template-executive .r-contacts { color: #555; font-size: 12px; }
.template-executive .r-body { display: flex; }
.template-executive .r-main { flex: 2; padding: 26px 36px; }
.template-executive .r-side { flex: 1; padding: 26px 22px; background: #f8fafc; }

/* ══ TEMPLATE: ELEGANT ══ */
.template-elegant .r-header { background: #1a0a2e; color: #fff; padding: 32px 36px; display: flex; gap: 22px; align-items: center; border-bottom: 4px solid var(--rc); }
.template-elegant .r-name { font-size: 26px; color: #fff; font-family: 'Playfair Display', serif; }
.template-elegant .r-title { color: var(--rc); font-size: 14px; }
.template-elegant .r-contacts { color: rgba(255,255,255,0.8); }
.template-elegant .r-body { display: flex; align-items: stretch; }
.template-elegant .r-main { flex: 2; padding: 26px 30px; }
.template-elegant .r-side { flex: 1; padding: 26px 20px; background: #1a0a2e; align-self: stretch; }
.template-elegant .r-side .r-sec-title { color: var(--rc); border-bottom-color: var(--rc); }
.template-elegant .r-side p, .template-elegant .r-side span, .template-elegant .r-side .r-lang-item { color: rgba(255,255,255,0.85); font-size: 11px; }
.template-elegant .r-side .r-exp-role { color: var(--rc); }
.template-elegant .r-side .r-skill-tag { background: var(--rc); }

/* ══ TEMPLATE: CREATIVE ══ */
.template-creative .r-body { display: flex; align-items: stretch; }
.template-creative .r-sidebar { width: 270px; background: var(--rc); padding: 0; color: #fff; position: relative; overflow: hidden; display: flex; flex-direction: column; align-self: stretch; }
.template-creative .r-sidebar::after { content: ''; position: absolute; bottom: -80px; right: -50px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,0.06); }
.template-creative .r-header { background: rgba(0,0,0,0.2); padding: 28px 20px; text-align: center; margin-bottom: 0; display: flex; flex-direction: column; align-items: center; }
.template-creative .r-photo { margin: 0 auto 12px; border-color: rgba(255,255,255,0.5); width: 88px; height: 88px; display: block; flex-shrink: 0; }
.template-creative .r-name { font-size: 19px; color: #fff; display: block; width: 100%; word-break: break-word; text-align: center; }
.template-creative .r-title { color: rgba(255,255,255,0.8); font-size: 12px; display: block; width: 100%; word-break: break-word; text-align: center; margin-top: 4px; }
.template-creative .r-sb-sec { padding: 14px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.template-creative .r-sb-sec h3 { font-size: 9px; text-transform: uppercase; letter-spacing: 2px; color: rgba(255,255,255,0.5); margin-bottom: 8px; }
.template-creative .r-sb-sec p, .template-creative .r-sb-sec span { font-size: 11px; color: rgba(255,255,255,0.85); display: block; margin: 2px 0; }
.template-creative .r-main { flex: 1; padding: 28px 24px; }

/* ══ TEMPLATE: FRESH ══ */
.template-fresh .r-header { background: #fff; padding: 28px 32px; display: flex; gap: 20px; align-items: center; border-bottom: 4px solid var(--rc); }
.template-fresh .r-name { font-size: 26px; color: #1e293b; }
.template-fresh .r-title { color: var(--rc); font-weight: 600; }
.template-fresh .r-photo { border-color: var(--rc); }
.template-fresh .r-body { display: flex; }
.template-fresh .r-main { flex: 2; padding: 24px 28px; }
.template-fresh .r-side { flex: 1; padding: 24px 20px; border-left: 3px solid var(--rc); }
.template-fresh .r-skill-tag { border-radius: 4px; }

/* ══ TEMPLATE: SHARP ══ */
.template-sharp .r-header { background: var(--rc); color: #fff; padding: 28px 36px; clip-path: polygon(0 0, 100% 0, 100% 75%, 0 100%); padding-bottom: 50px; }
.template-sharp .r-name { font-size: 28px; color: #fff; font-weight: 800; }
.template-sharp .r-title { color: rgba(255,255,255,0.85); }
.template-sharp .r-contacts { color: rgba(255,255,255,0.85); }
.template-sharp .r-body { display: flex; margin-top: -10px; }
.template-sharp .r-main { flex: 2; padding: 16px 30px 24px; }
.template-sharp .r-side { flex: 1; padding: 16px 22px 24px; background: #f8fafc; }

/* ══ TEMPLATE: STELLAR ══ */
.template-stellar .r-body { display: flex; align-items: stretch; }
.template-stellar .r-sidebar { width: 250px; background: linear-gradient(160deg, var(--rc) 60%, #1e293b); padding: 30px 20px; color: #fff; display: flex; flex-direction: column; align-self: stretch; }
.template-stellar .r-header { text-align: center; padding-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,0.2); margin-bottom: 16px; display: flex; flex-direction: column; align-items: center; }
.template-stellar .r-photo { margin: 0 auto 12px; border-color: rgba(255,255,255,0.5); display: block; flex-shrink: 0; }
.template-stellar .r-name { font-size: 18px; color: #fff; display: block; width: 100%; word-break: break-word; text-align: center; }
.template-stellar .r-title { color: rgba(255,255,255,0.75); font-size: 12px; display: block; width: 100%; word-break: break-word; text-align: center; margin-top: 4px; }
.template-stellar .r-sb-sec { margin-bottom: 16px; }
.template-stellar .r-sb-sec h3 { font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(255,255,255,0.5); border-bottom: 1px solid rgba(255,255,255,0.15); padding-bottom: 4px; margin-bottom: 8px; }
.template-stellar .r-sb-sec p, .template-stellar .r-sb-sec span { font-size: 11px; color: rgba(255,255,255,0.85); display: block; margin: 2px 0; }
.template-stellar .r-main { flex: 1; padding: 28px 24px; }
.template-stellar .r-skill-tag { background: rgba(255,255,255,0.2); }

/* ══ TEMPLATE: REFINED ══ */
.template-refined .r-header { padding: 32px 40px; background: #fff; }
.template-refined .r-name { font-size: 30px; color: #1e293b; font-weight: 300; letter-spacing: -1px; border-bottom: 2px solid var(--rc); padding-bottom: 10px; display: inline-block; }
.template-refined .r-title { color: var(--rc); margin-top: 8px; font-weight: 500; }
.template-refined .r-contacts { color: #888; font-size: 12px; }
.template-refined .r-body { display: flex; }
.template-refined .r-main { flex: 2; padding: 24px 36px; }
.template-refined .r-side { flex: 1; padding: 24px 24px; border-left: 2px solid #f1f5f9; }
.template-refined .r-sec-title { border-bottom: 1px solid var(--rc); }
.template-refined .r-skill-tag { background: #f1f5f9; color: var(--rc); border: 1px solid var(--rc); }

/* ══ TEMPLATE: IMPACT ══ */
.template-impact .r-header { background: #111; color: #fff; padding: 32px 36px; display: flex; gap: 22px; align-items: center; border-left: 8px solid var(--rc); }
.template-impact .r-name { font-size: 30px; color: #fff; font-weight: 900; text-transform: uppercase; letter-spacing: 1px; }
.template-impact .r-title { color: var(--rc); font-weight: 600; font-size: 14px; }
.template-impact .r-contacts { color: rgba(255,255,255,0.75); }
.template-impact .r-body { display: flex; }
.template-impact .r-main { flex: 2; padding: 26px 30px; }
.template-impact .r-side { flex: 1; padding: 26px 22px; border-left: 4px solid var(--rc); background: #f8fafc; }
.template-impact .r-sec-title { color: var(--rc); border-bottom-color: var(--rc); }

/* ══ ADMIN ══ */
.rbp-admin h1 { color: #1e293b; }

/* ══ RESPONSIVE ══ */
@media (max-width: 1100px) {
  .rbp-builder-body { flex-direction: column; height: auto; overflow: visible; }
  .rbp-form-panel { width: 100%; min-width: 0; height: auto; border-right: none; border-bottom: 1px solid var(--rbp-border); }
  .rbp-tab-content { height: auto; max-height: 60vh; overflow-y: auto !important; }
  .rbp-preview-wrap { padding: 12px 8px; overflow-x: hidden; }
  /* DO NOT add width:100% here — breaks transform:scale() */
}
@media (max-width: 600px) {
  .rbp-gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .rbp-customize-bar { flex-wrap: nowrap; overflow-x: auto; }
  .rbp-builder-actions { gap: 8px; }
  .rbp-row { grid-template-columns: 1fr; }
  .rbp-builder-header { flex-wrap: wrap; }
}

/* WordPress admin bar offset */
.admin-bar .rbp-builder-header { top: 32px; }
.admin-bar .rbp-builder-body { height: calc(100vh - 192px); }

/* AI SUMMARY BOX */
.rbp-ai-box {
  margin-top: 14px;
  border: 1.5px solid #c7d7fe;
  border-radius: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #f0f4ff 0%, #fafaff 100%);
}

.rbp-ai-box-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.rbp-ai-icon { font-size: 16px; color: #2563eb; }

.rbp-ai-box-header strong {
  font-size: 14px;
  color: #1e40af;
}

.rbp-ai-badge {
  margin-left: auto;
  font-size: 10px;
  background: #2563eb;
  color: #fff;
  padding: 4px 2px;
  border-radius: 20px;
  font-weight: 600;
}

.rbp-ai-desc {
  font-size: 12px;
  color: #64748b;
  margin: 0 0 10px;
  line-height: 1.5;
}

.rbp-ai-box #rbp-ai-prompt {
  width: 100%;
  border: 1.5px solid #bfdbfe;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: #1e293b;
  background: #fff;
  resize: vertical;
  box-sizing: border-box;
}

.rbp-ai-box #rbp-ai-prompt:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.rbp-ai-generate-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  justify-content: center;
}

.rbp-ai-generate-btn:disabled {
  opacity: .65;
  cursor: not-allowed;
}

.rbp-ai-error {
  margin-top: 10px;
  padding: 9px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 7px;
  color: #dc2626;
  font-size: 12px;
}

.rbp-ai-choose-label {
  font-size: 12px;
  color: #475569;
  margin: 14px 0 8px;
  font-weight: 600;
}

.rbp-ai-suggestion-card {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.rbp-ai-card-active {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12) !important;
}

.rbp-ai-suggestion-num {
  font-size: 11px;
  font-weight: 700;
  color: #2563eb;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.rbp-ai-suggestion-text {
  font-size: 13px;
  color: #334155;
  line-height: 1.6;
  margin: 0 0 10px;
}

.rbp-ai-use-btn {
  background: #eff6ff;
  color: #2563eb;
  border: 1.5px solid #bfdbfe;
  border-radius: 6px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* SUMMARY SPELLING ASSIST */
.rbp-spell-assist {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff7f7;
}

.rbp-spell-title {
  font-size: 12px;
  font-weight: 700;
  color: #b91c1c;
  margin-bottom: 6px;
}

.rbp-spell-preview {
  min-height: 28px;
  padding: 8px 10px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  line-height: 1.6;
  color: #1e293b;
  white-space: pre-wrap;
  word-break: break-word;
}

.rbp-spell-help {
  margin-top: 6px;
  font-size: 11px;
  color: #7f1d1d;
}

.rbp-spell-issue {
  position: relative;
  display: inline;
  border: none;
  background: transparent;
  color: #1e293b;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-decoration-line: underline;
  text-decoration-style: wavy;
  text-decoration-color: #dc2626;
  text-underline-offset: 2px;
}

.rbp-spell-issue .rbp-spell-tooltip {
  display: none;
  position: absolute;
  left: 0;
  top: -30px;
  white-space: nowrap;
  background: #111827;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  border-radius: 6px;
  padding: 6px 8px;
  z-index: 40;
}

.rbp-spell-issue:hover .rbp-spell-tooltip,
.rbp-spell-issue:focus .rbp-spell-tooltip {
  display: inline-block;
}
