/* ===== VARIABLES ===== */
:root {
  --bg-color: #eef1f5;
  --header-bg: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --header-text: #f1f5f9;
  --text-color: #334155;
  --text-heading: #1e293b;
  --text-light: #64748b;
  --text-muted: #94a3b8;
  --line-color: #6366f1;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-bg: rgba(99, 102, 241, 0.08);
  --success: #10b981;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --accent-font-weight: 700;
  --font-bold-semi: 600;
}

/* ===== RESET ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===== BASE ===== */
body {
  font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.7;
  display: flex;
  justify-content: center;
  padding: 40px 20px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== CV CONTAINER (Khổ A4: 210mm x 297mm = 794px x 1123px ở 96dpi) ===== */
.cv-container {
  width: 996px;
  min-height: 1123px;
  background: var(--card-bg);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}

/* ===== HEADER ===== */
.cv-header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 36px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.cv-header::before {
  content: "";
  position: absolute;
  top: -60%;
  right: -20%;
  width: 50%;
  height: 220%;
  background: radial-gradient(
    circle,
    rgba(99, 102, 241, 0.12) 0%,
    transparent 60%
  );
  pointer-events: none;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 24px;
  position: relative;
  z-index: 1;
}

.avatar {
  width: 110px;
  height: 110px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
  transition: var(--transition);
}

.avatar:hover {
  transform: scale(1.05);
  border-color: rgba(255, 255, 255, 0.5);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.name-title h1 {
  font-size: 30px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  line-height: 1.2;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 15px;
  color: var(--accent-light);
  font-weight: 500;
  letter-spacing: 0.5px;
}

.header-right {
  display: flex;
  gap: 32px;
  font-size: 14px;
  position: relative;
  z-index: 1;
}

.contact-info p,
.personal-info p {
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #cbd5e1;
  transition: var(--transition);
}

.contact-info p:hover,
.personal-info p:hover {
  color: #f1f5f9;
}

.contact-info p i,
.personal-info p i {
  width: 16px;
  text-align: center;
  color: var(--accent-light);
  font-size: 13px;
  flex-shrink: 0;
}

.contact-info a,
.personal-info a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: var(--transition);
}

.contact-info a:hover,
.personal-info a:hover {
  color: #fff;
  border-bottom-color: var(--accent-light);
}

/* ===== BODY & TIMELINE ===== */
.cv-body {
  padding: 36px 44px;
  position: relative;
}
time {
  font-size: 14px;
}

.timeline-line {
  position: absolute;
  left: 59px;
  top: 20px;
  bottom: 20px;
  width: 2px;
  background: linear-gradient(
    to bottom,
    var(--accent),
    var(--accent-light),
    var(--accent)
  );
  z-index: 0;
  border-radius: 2px;
  opacity: 0.3;
}

/* ===== SECTIONS ===== */
.cv-section {
  position: relative;
  display: flex;
  margin-bottom: 32px;
  z-index: 1;
}

.section-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
  margin-right: 24px;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(99, 102, 241, 0.3);
  transition: var(--transition);
}

.cv-section:hover .section-icon {
  transform: scale(1.1);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.section-content {
  flex: 1;
  min-width: 0;
}

.section-title {
  text-transform: uppercase;
  font-size: 16px;
  letter-spacing: 1px;
  color: var(--text-heading);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 6px;
  margin-bottom: 16px;
  font-weight: var(--accent-font-weight);
  position: relative;
}

/* ===== CONTENT ITEMS ===== */
.content-item {
  background: var(--accent-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 14px;
  transition: var(--transition);
  position: relative;
}

.content-item:hover {
  border-color: var(--accent-light);
  box-shadow: var(--shadow-sm);
  transform: translateX(4px);
}

.content-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  background: linear-gradient(to bottom, var(--accent), var(--accent-light));
  border-radius: 0 3px 3px 0;
  opacity: 0;
  transition: var(--transition);
}

.content-item:hover::before {
  opacity: 1;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-weight: var(--font-bold-semi);
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.item-header strong {
  color: var(--text-heading);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.4;
}

.item-header span {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(99, 102, 241, 0.08);
  padding: 2px 10px;
  border-radius: 50px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.item-sub {
  font-style: italic;
  margin-bottom: 6px;
  color: var(--text-light);
  font-size: 14px;
}

/* ===== DETAILS LIST ===== */
.details-list {
  padding-left: 18px;
  font-size: 14px;
  color: var(--text-color);
  line-height: 1.7;
}

.details-list li {
  margin-bottom: 4px;
  position: relative;
}

.details-list li::marker {
  color: var(--accent);
}

.details-list ul {
  padding-left: 18px;
  margin-top: 4px;
}

.details-list ul li::marker {
  color: var(--accent-light);
}

/* ===== SKILLS LIST ===== */

.skills-list {
  list-style: none;
  font-size: 14px;
}

.skills-list li {
  margin-bottom: 4px;
  padding-left: 16px;
  position: relative;
}

.skills-list li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

/* ===== PROJECT METADATA ===== */

.item-role {
  font-weight: var(--accent-font-weight);
  margin-top: 4px;
  font-size: 14px;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.item-date {
  font-style: italic;
  color: var(--text-muted);
  margin-top: 3px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.item-description {
  font-size: 14px;
  color: var(--text-light);
  margin-top: 2px;
}

/* ===== SECTION CONTENT PARAGRAPH ===== */

.section-content > p {
  font-size: 14px;
  color: var(--text-color);
  line-height: 1.7;
  background: var(--accent-bg);
  padding: 14px 20px;
  border-radius: 10px;
  border-left: 3px solid var(--accent);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  body {
    padding: 16px 8px;
  }

  .cv-container {
    width: 100%;
    min-height: auto;
    border-radius: 8px;
  }

  .cv-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    padding: 28px 24px;
  }

  .header-right {
    flex-direction: column;
    gap: 16px;
  }

  .cv-body {
    padding: 24px 20px;
  }

  .timeline-line {
    left: 36px;
  }

  .section-icon {
    width: 28px;
    height: 28px;
    font-size: 11px;
    margin-right: 16px;
  }

  .name-title h1 {
    font-size: 22px;
  }

  .avatar {
    width: 80px;
    height: 80px;
  }

  .content-item {
    padding: 12px 14px;
  }

  .item-header {
    flex-direction: column;
    gap: 4px;
  }
}

@media (max-width: 480px) {
  .cv-header {
    padding: 20px 16px;
  }

  .cv-body {
    padding: 20px 14px;
  }

  .section-title {
    font-size: 14px;
  }

  .details-list {
    font-size: 12px;
  }
}

/* ===== PRINT ===== */
@media print {
  *,
  *::before,
  *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  body {
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    display: block !important;
  }

  .cv-container {
    width: 100% !important;
    min-height: auto !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  .cv-header {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 32px 16px !important;
    background: #0f172a !important;
    color: #f1f5f9 !important;
  }

  .cv-header::before {
    display: none !important;
  }

  .header-left {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 16px !important;
    flex-shrink: 0 !important;
  }

  .header-right {
    display: flex !important;
    flex-direction: row !important;
    gap: 28px !important;
    flex-shrink: 0 !important;
  }

  .avatar {
    width: 80px !important;
    height: 80px !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: none !important;
    background: #6366f1 !important;
  }

  .avatar:hover {
    transform: none !important;
  }

  .name-title h1 {
    font-size: 24px !important;
    color: #fff !important;
    letter-spacing: 1px !important;
  }

  .subtitle {
    color: #a5b4fc !important;
    font-size: 14px !important;
    font-weight: 500 !important;
  }

  .contact-info p,
  .personal-info p {
    color: #e2e8f0 !important;
    margin-bottom: 5px !important;
    font-size: 13px !important;
    gap: 8px !important;
    line-height: 1.5 !important;
  }

  .contact-info p i,
  .personal-info p i {
    color: #a5b4fc !important;
    font-size: 13px !important;
    width: 18px !important;
  }

  .contact-info a {
    color: #e2e8f0 !important;
    text-decoration: none !important;
    font-size: 12.5px !important;
  }

  /* ===== BODY ===== */
  .cv-body {
    padding: 24px 32px !important;
  }

  /* ===== TIMELINE ===== */
  .timeline-line {
    background: #6366f1 !important;
    opacity: 0.15 !important;
  }

  /* ===== SECTION ICONS ===== */
  .section-icon {
    background: #6366f1 !important;
    color: #fff !important;
    box-shadow: none !important;
  }

  .cv-section:hover .section-icon {
    transform: none !important;
  }
  /* ===== CONTENT ITEMS ===== */
  .content-item {
    background: #f8f9ff !important;
    border: 1px solid #e2e8f0 !important;
  }

  .content-item:hover {
    transform: none !important;
    box-shadow: none !important;
    border-color: #e2e8f0 !important;
  }

  .content-item::before {
    display: none !important;
  }

  /* KHÔNG dùng break-inside: avoid cho .cv-section
     vì section lớn sẽ đẩy nguyên khối sang trang mới,
     gây khoảng trống lớn. Chỉ dùng cho .content-item nhỏ. */

  /* ===== BADGES THỜI GIAN ===== */
  .item-header span {
    background: #eef0ff !important;
    color: #64748b !important;
  }

  /* ===== ROLE ===== */
  .item-role {
    color: #6366f1 !important;
  }

  /* ===== LIST MARKERS ===== */
  .details-list li::marker {
    color: #6366f1 !important;
  }

  /* ===== PARAGRAPH (Mục tiêu) ===== */
  .section-content > p {
    background: #f8f9ff !important;
    border-left: 3px solid #6366f1 !important;
  }

  /* ===== ẨN SCROLLBAR ===== */
  ::-webkit-scrollbar {
    display: none !important;
  }
}
