*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --red: #c0392b;
  --red-dark: #922b21;
  --red-light: #e74c3c;
  --cream: #faf8f4;
  --dark: #1a1a1a;
  --mid: #4a4a4a;
  --light: #8a8a8a;
  --rule: #e0d8d0;
  --col-left: 220px;
  --col-right: 1fr;
  /* Navbar vars */
  --ink: #0f0e0d;
  --paper: #f5f2ee;
  --gold: #b8933f;
  --gold-light: #d4aa5a;
  --accent: #c8472b;
  --border: rgba(15, 14, 13, 0.12);
  --muted: #6b6560;
}

/* ── BACK NAVBAR ── */
.back-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 3rem;
  background: rgba(245, 242, 238, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.back-nav-logo {
  font-family: "Playfair Display", serif;
  font-weight: 900;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.back-nav-logo span {
  color: var(--accent);
}

.back-nav-right {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.back-nav-label {
  font-family: "DM Sans", sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.back-nav-btn {
  font-family: "DM Sans", sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  text-decoration: none;
  padding: 0.5rem 1.2rem;
  border-radius: 2px;
  transition: background 0.2s;
}

.back-nav-btn:hover {
  background: var(--accent);
}

/* ── EDIT HINTS ── */
[contenteditable="true"]:hover {
  outline: 1.5px dashed rgba(192, 57, 43, 0.45);
  border-radius: 2px;
  cursor: text;
}

[contenteditable="true"]:focus {
  outline: 2px solid var(--red);
  border-radius: 2px;
  background: rgba(192, 57, 43, 0.05);
}

/* ── BODY ── */
body {
  font-family: "DM Sans", sans-serif;
  background: #e8e4df;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 90px 20px 80px;
}

/* ── TOAST ── */
.saved-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #1a5c3a;
  color: #fff;
  font-family: "Source Sans 3", sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 8px 16px;
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 999;
  pointer-events: none;
}

.saved-toast.show {
  opacity: 1;
}

/* ── PAGE ── */
.page {
  width: 210mm;
  min-height: 297mm;
  background: var(--cream);
  position: relative;
  overflow: hidden;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.25),
    0 4px 16px rgba(0, 0, 0, 0.1);
}

/* ── HEADER ── */
.header {
  background: var(--dark);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0;
  padding: 0;
  position: relative;
}

.header-photo-col {
  background: var(--red);
  padding: 18px 20px 18px 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 100%;
  cursor: pointer;
}

.header-photo-col:hover {
  background: var(--red-dark);
}

.header-photo-col::after {
  content: "";
  position: absolute;
  top: 0;
  right: -22px;
  width: 0;
  height: 0;
  border-left: 22px solid var(--red);
  border-top: 0px solid transparent;
  border-bottom: 130px solid transparent;
  pointer-events: none;
}

.header-photo-col:hover::after {
  border-left-color: var(--red-dark);
}

.photo-frame {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.45);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.photo-ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 8.5px;
  text-align: center;
  pointer-events: none;
}

.photo-ph svg {
  width: 22px;
  height: 22px;
}

#photo-input {
  display: none;
}

.header-info {
  padding: 18px 24px 18px 40px;
  display: grid;
  grid-template-rows: auto auto;
  gap: 10px;
}

.header-top {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

.name {
  font-family: "Playfair Display", serif;
  font-weight: 900;
  font-size: 22px;
  color: #ffffff;
  line-height: 1.1;
  letter-spacing: -0.3px;
}

.role-tag {
  display: inline-block;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 2px;
  white-space: nowrap;
  position: relative;
  top: -1px;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 20px;
}

.contact-item {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
}

.contact-item .dot {
  display: inline-block;
  width: 3.5px;
  height: 3.5px;
  background: var(--red-light);
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── BODY LAYOUT ── */
.body {
  display: grid;
  grid-template-columns: var(--col-left) var(--col-right);
  min-height: calc(297mm - 130px);
}

/* ── LEFT SIDEBAR ── */
.sidebar {
  background: #222222;
  padding: 24px 18px;
  color: #fff;
}

.sidebar-section {
  margin-bottom: 24px;
  position: relative;
}

.sidebar-title {
  font-family: "Playfair Display", serif;
  font-size: 10px;
  font-weight: 700;
  color: var(--red-light);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 12px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.skill-item {
  margin-bottom: 10px;
  position: relative;
}

.skill-name {
  font-size: 10.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 4px;
  display: block;
}

.skill-bar-bg {
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
}

.skill-bar-bg:hover {
  background: rgba(255, 255, 255, 0.18);
}

.skill-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--red-light));
  border-radius: 2px;
}

.soft-skill {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-bottom: 7px;
  position: relative;
}

.soft-skill::before {
  content: "▸";
  color: var(--red-light);
  font-size: 10px;
  margin-top: 1px;
  flex-shrink: 0;
}

.soft-skill span {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.4;
}

.edu-item {
  margin-bottom: 12px;
  position: relative;
}

.edu-degree {
  font-size: 10.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.3;
  margin-bottom: 2px;
}

.edu-inst {
  font-size: 9.5px;
  color: rgba(255, 255, 255, 0.42);
  line-height: 1.3;
}

/* ── RIGHT MAIN CONTENT ── */
.main {
  padding: 24px 26px;
}

.section {
  margin-bottom: 22px;
  position: relative;
}

.section-title {
  font-family: "Playfair Display", serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--dark);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--red) 0%, var(--rule) 100%);
}

.objetivo-text {
  font-size: 11px;
  color: var(--mid);
  line-height: 1.7;
  border-left: 3px solid var(--red);
  padding-left: 12px;
  font-style: italic;
}

.job {
  margin-bottom: 16px;
  position: relative;
  padding-left: 14px;
}

.job::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 5px;
  height: 5px;
  background: var(--red);
  border-radius: 50%;
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2px;
  gap: 8px;
}

.job-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--dark);
  line-height: 1.3;
}

.job-period {
  font-size: 9.5px;
  color: var(--red);
  font-weight: 500;
  white-space: nowrap;
  background: rgba(192, 57, 43, 0.07);
  padding: 2px 7px;
  border-radius: 2px;
  flex-shrink: 0;
}

.job-company {
  font-size: 10px;
  color: var(--light);
  margin-bottom: 6px;
  font-weight: 400;
}

.job-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.job-bullets li {
  font-size: 10px;
  color: var(--mid);
  line-height: 1.55;
  padding-left: 12px;
  padding-right: 18px;
  position: relative;
}

.job-bullets li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--red);
  font-size: 9px;
  top: 1px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

.tool-card {
  background: white;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--red);
  padding: 7px 10px;
  border-radius: 0 4px 4px 0;
  position: relative;
}

.tool-card-name {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 2px;
}

.tool-card-desc {
  font-size: 9.5px;
  color: var(--light);
  line-height: 1.4;
}

.courses-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.course-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 10px;
  color: var(--mid);
  position: relative;
}

.course-item::before {
  content: "◆";
  color: var(--red);
  font-size: 6px;
  flex-shrink: 0;
  position: relative;
  top: -1px;
}

.footer-strip {
  background: var(--dark);
  padding: 7px 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-strip span {
  font-size: 8.5px;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 0.08em;
}

.footer-strip .footer-dots {
  display: flex;
  gap: 4px;
}

.footer-strip .footer-dots span {
  width: 5px;
  height: 5px;
  background: var(--red);
  border-radius: 50%;
  opacity: 0.6;
}

/* ══════════════════════════════════════
       DYNAMIC CONTROLS
    ══════════════════════════════════════ */

/* Section wrapper — reveals add row on hover */
.section-wrap {
  position: relative;
}

.section-wrap:hover .dyn-add-row,
.sidebar-section:hover .dyn-add-row {
  opacity: 1;
  pointer-events: all;
}

/* dyn-block — reveals remove button on hover */
.dyn-block {
  position: relative;
}

.dyn-block:hover > .dyn-remove {
  opacity: 1;
  pointer-events: all;
}

/* Remove button */
.dyn-remove {
  position: absolute;
  top: 1px;
  right: 0px;
  width: 15px;
  height: 15px;
  background: #d94040;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.15s,
    background 0.15s;
  z-index: 10;
}

.dyn-remove:hover {
  background: #b02020;
}

/* Add button row */
.dyn-add-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.dyn-add-btn {
  font-family: "Source Sans 3", sans-serif;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red-light);
  background: transparent;
  border: 1px dashed var(--red-light);
  border-radius: 2px;
  padding: 2px 7px;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
  white-space: nowrap;
}

.dyn-add-btn:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

/* Show inline add buttons on job hover */
.job:hover .job-inline-controls {
  opacity: 1;
  pointer-events: all;
}

.job-inline-controls {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  margin-top: 5px;
  display: flex;
  gap: 5px;
}

/* Li remove button */
.li-remove {
  position: absolute;
  right: 0;
  top: 3px;
  width: 13px;
  height: 13px;
  background: #d94040;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.job-bullets li:hover .li-remove {
  display: flex;
}

/* Skill remove */
.skill-remove {
  position: absolute;
  top: 0;
  right: -16px;
  width: 13px;
  height: 13px;
  background: #d94040;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 9px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.skill-item:hover .skill-remove {
  display: flex;
}

/* Soft-skill remove */
.soft-remove {
  position: absolute;
  top: 1px;
  right: -16px;
  width: 13px;
  height: 13px;
  background: #d94040;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 9px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.soft-skill:hover .soft-remove {
  display: flex;
}

/* Course remove */
.course-remove {
  position: absolute;
  right: -16px;
  top: 1px;
  width: 13px;
  height: 13px;
  background: #d94040;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 9px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.course-item:hover .course-remove {
  display: flex;
}

/* Tool card remove */
.tool-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 14px;
  height: 14px;
  background: #d94040;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 9px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

.tool-card:hover .tool-remove {
  display: flex;
}

/* ── TOOLBAR ── */
.toolbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 20px;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.toolbar-hint {
  font-family: "Source Sans 3", sans-serif;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 1px;
  margin-right: 10px;
  text-transform: uppercase;
}

.btn {
  font-family: "Source Sans 3", sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 7px 16px;
  border-radius: 3px;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn:hover {
  opacity: 0.85;
}

.btn-print {
  background: var(--red);
  color: #fff;
}

.btn-save {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-reset {
  background: transparent;
  color: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 9px;
}

/* ── PRINT ── */
@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  html,
  body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    width: 210mm;
    height: 297mm;
    margin: 0;
    padding: 0;
    background: none;
  }

  body {
    display: block;
    padding: 0;
  }

  .page {
    width: 210mm !important;
    height: 297mm !important;
    min-height: unset !important;
    box-shadow: none !important;
    overflow: hidden !important;
    page-break-after: avoid;
    break-after: avoid;
  }

  .toolbar,
  .back-nav,
  .saved-toast {
    display: none !important;
  }

  .dyn-add-row,
  .dyn-remove,
  .li-remove,
  .skill-remove,
  .soft-remove,
  .course-remove,
  .tool-remove,
  .job-inline-controls {
    display: none !important;
  }

  .photo-ph {
    display: none !important;
  }

  [contenteditable="true"]:hover,
  [contenteditable="true"]:focus {
    outline: none !important;
    background: transparent !important;
  }

  .header,
  .sidebar,
  .skill-bar-fill,
  .role-tag,
  .job-period,
  .tool-card,
  .footer-strip {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
