/* ==========================================================================
   CV Template - Nguyễn Đắc Hoàng
   Design: Modern Warm Earth Elegant (TopCV Style Refined)
   Font: Plus Jakarta Sans / Inter with Full Vietnamese Diacritics
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

:root {
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  
  /* Color Palette - Matching exact original warm earthy tones */
  --header-bg: #faefe4;
  --header-text: #32251e;
  --header-badge-bg: #534338;
  --header-badge-text: #ffffff;
  
  --sidebar-bg: #534338;
  --sidebar-heading: #ffffff;
  --sidebar-subheading: #eae3dd;
  --sidebar-text: #e2dad4;
  --sidebar-label: #c8bbb2;
  --sidebar-badge-bg: #403229;
  --sidebar-divider: rgba(255, 255, 255, 0.14);
  --sidebar-accent: #e5b98a;
  
  --main-bg: #fdfbf7;
  --main-heading: #2d221b;
  --main-subheading: #3a2e26;
  --main-text: #453830;
  --main-text-light: #6a594f;
  --main-divider: #3a2e26;
  --main-bullet: #534338;
  --link-color: #6a3e1b;
  --link-hover: #b45309;

  --tag-bg: #f1e7de;
  --tag-text: #433329;
  
  --shadow-sm: 0 2px 8px rgba(50, 37, 30, 0.06);
  --shadow-md: 0 10px 30px rgba(50, 37, 30, 0.12);
  --shadow-lg: 0 20px 45px rgba(50, 37, 30, 0.18);
  
  /* A4 Dimensions (standard 210mm x 297mm) */
  --a4-width: 210mm;
  --a4-min-height: 297mm;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: #e9e4df;
  color: var(--main-text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 60px;
}

/* ==========================================================================
   Top Floating Toolbar (Action Bar) - Interactive & Non-printable
   ========================================================================== */
.toolbar-container {
  width: 100%;
  max-width: 900px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(60, 45, 36, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.8);
  z-index: 100;
  position: sticky;
  top: 16px;
  transition: all 0.3s ease;
}

.toolbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  color: #3f3127;
}

.toolbar-brand svg {
  width: 22px;
  height: 22px;
  fill: #534338;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: #534338;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(83, 67, 56, 0.25);
}

.btn-primary:hover {
  background: #3e3128;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(83, 67, 56, 0.35);
}

.btn-secondary {
  background: #f4ede6;
  color: #4a3b31;
  border-color: #dfd4cc;
}

.btn-secondary:hover {
  background: #ebe0d6;
  color: #32251e;
}

.btn-outline {
  background: transparent;
  border-color: #d1c5bc;
  color: #55443a;
}

.btn-outline:hover {
  background: #fdfbf8;
  border-color: #534338;
  color: #32251e;
}

.btn.active {
  background: #ebd8c7;
  color: #403025;
  border-color: #bfa48f;
}

/* ==========================================================================
   CV Main Container & Paper Styling (A4 Ratio)
   ========================================================================== */
.cv-wrapper {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

.cv-page {
  width: 100%;
  background: var(--main-bg);
  box-shadow: var(--shadow-lg);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Header Banner */
.cv-header {
  background: var(--header-bg);
  padding: 24px 36px 20px 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #ecd8c7;
}

.header-name {
  font-size: 29px;
  font-weight: 800;
  color: var(--header-text);
  letter-spacing: -0.4px;
  line-height: 1.15;
}

.header-title-badge {
  background: var(--header-badge-bg);
  color: var(--header-badge-text);
  font-size: 14.5px;
  font-weight: 600;
  padding: 7px 18px;
  border-radius: 4px;
  letter-spacing: 0.2px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Two Columns Body */
.cv-body {
  display: grid;
  grid-template-columns: 275px 1fr;
  flex: 1;
}

/* ==========================================================================
   Left Column: Sidebar
   ========================================================================== */
.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 24px 20px 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Avatar Section */
.avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.avatar-frame {
  width: 180px;
  height: 220px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  background: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.avatar-frame:hover {
  border-color: #ffffff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.avatar-placeholder-content {
  width: 100%;
  height: 100%;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #c4b8ad;
  transition: all 0.2s ease;
  user-select: none;
}

.placeholder-icon {
  width: 76px;
  height: 76px;
  fill: #ded6ce;
  transition: all 0.2s ease;
}

.placeholder-hint {
  font-size: 11px;
  font-weight: 600;
  color: #9c8e82;
  opacity: 0.8;
  letter-spacing: 0.2px;
}

.avatar-frame:hover .placeholder-icon {
  fill: #b3a598;
  transform: scale(1.05);
}

.avatar-frame:hover .placeholder-hint {
  opacity: 1;
  color: #534338;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  transition: transform 0.4s ease;
}

.avatar-frame:hover .avatar-img {
  transform: scale(1.03);
}

.role-badge {
  display: inline-block;
  background: var(--sidebar-badge-bg);
  color: #f7ede5;
  font-size: 13.5px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 4px;
  text-align: center;
  letter-spacing: 0.2px;
  width: 100%;
  max-width: 190px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Sidebar Section Headers */
.sidebar-section-title {
  display: inline-block;
  background: var(--sidebar-badge-bg);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 3px;
  margin-bottom: 12px;
  letter-spacing: 0.3px;
}

.sidebar-divider {
  height: 1px;
  background: var(--sidebar-divider);
  margin: 4px 0;
}

/* Sidebar Contact Info */
.info-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.info-label {
  font-size: 11px;
  color: var(--sidebar-label);
  text-transform: capitalize;
  display: flex;
  align-items: center;
  gap: 6px;
}

.info-label svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
  opacity: 0.85;
}

.info-value {
  font-size: 12.5px;
  color: #ffffff;
  font-weight: 500;
  word-break: break-word;
  line-height: 1.35;
}

.info-link {
  color: #ffffff;
  text-decoration: none;
  transition: color 0.2s ease;
  display: inline-block;
}

.info-link:hover {
  color: var(--sidebar-accent);
  text-decoration: underline;
}

/* Education in Sidebar */
.edu-sidebar-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.edu-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
}

.edu-school {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
}

.edu-period {
  font-size: 11px;
  color: #d8cec6;
  white-space: nowrap;
}

.edu-major {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--sidebar-accent);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 3px;
}

.edu-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edu-bullets li {
  font-size: 11.5px;
  line-height: 1.45;
  color: #eae1db;
  position: relative;
  padding-left: 10px;
}

.edu-bullets li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: #e5b98a;
}

/* Skills in Sidebar */
.skills-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skill-card {
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 9px 11px;
  font-size: 11.5px;
  line-height: 1.45;
  color: #f3ede8;
  transition: all 0.2s ease;
}

.skill-card:hover {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateX(2px);
}

/* References (Người giới thiệu) */
.ref-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ref-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ref-name {
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
}

.ref-phone {
  font-size: 11.5px;
  color: #dcd1c9;
}

.ref-phone a {
  color: #ffffff;
  text-decoration: none;
}

.ref-phone a:hover {
  color: var(--sidebar-accent);
  text-decoration: underline;
}

/* ==========================================================================
   Right Column: Main Content
   ========================================================================== */
.main-content {
  background: var(--main-bg);
  padding: 24px 32px 32px 30px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* Main Section Styling */
.main-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.main-section-title {
  font-size: 16.5px;
  font-weight: 800;
  color: var(--main-heading);
  letter-spacing: -0.2px;
  position: relative;
  padding-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.main-section-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: var(--main-divider);
  opacity: 0.85;
}

.section-text {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--main-text);
  text-align: justify;
}

/* Sub-items Header with Dates */
.item-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.item-main-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--main-subheading);
}

.item-date {
  font-size: 12px;
  font-weight: 500;
  color: var(--main-text-light);
  white-space: nowrap;
}

.item-subtitle {
  font-size: 12.5px;
  font-weight: 700;
  color: #4b3b32;
  margin-top: 1px;
}

/* Lists and Bullets */
.content-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.content-list li {
  font-size: 12px;
  line-height: 1.5;
  color: var(--main-text);
  position: relative;
  padding-left: 14px;
}

.content-list.dashed li::before {
  content: "–";
  position: absolute;
  left: 0;
  font-weight: 600;
  color: var(--main-bullet);
}

.content-list.dotted li::before {
  content: "•";
  position: absolute;
  left: 1px;
  font-size: 14px;
  line-height: 1.1;
  color: var(--main-bullet);
}

/* Project Cards */
.project-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed rgba(83, 67, 56, 0.15);
}

.project-card:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.project-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #31251e;
  line-height: 1.35;
}

.project-meta-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
}

.project-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #49392e;
}

.meta-label {
  font-weight: 600;
  color: #352820;
}

.meta-link {
  color: var(--link-color);
  text-decoration: underline;
  word-break: break-all;
  transition: color 0.2s ease;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 11.5px;
}

.meta-link:hover {
  color: var(--link-hover);
}

/* Tech Tags or Highlights */
.tech-highlight {
  font-weight: 600;
  color: #2b1f18;
}

/* Interests / Sở thích */
.interests-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 4px;
}

.interest-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--main-text);
  font-weight: 500;
  background: #f4ede6;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid #e7dcce;
}

.interest-item svg {
  width: 14px;
  height: 14px;
  fill: #534338;
}

/* Footer / watermark */
.cv-footer {
  padding: 10px 32px 14px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  font-size: 10px;
  color: #9f8f84;
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #362920;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast svg {
  width: 18px;
  height: 18px;
  fill: #73d13d;
}

/* ==========================================================================
   Content Editable State styling
   ========================================================================== */
[contenteditable="true"] {
  outline: 1.5px dashed #b98e6c !important;
  outline-offset: 2px;
  cursor: text;
  border-radius: 2px;
  background-color: rgba(255, 230, 200, 0.15);
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media screen and (max-width: 800px) {
  body {
    padding: 12px 8px;
  }
  
  .toolbar-container {
    padding: 10px 14px;
  }
  
  .cv-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 20px;
  }
  
  .cv-body {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    padding: 20px;
  }
  
  .avatar-frame {
    width: 140px;
    height: 170px;
  }
  
  .main-content {
    padding: 20px;
  }
}

/* ==========================================================================
   Print Styles - Exact Pixel-Perfect A4 Output
   ========================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 0; /* Full bleed to preserve background colors */
  }

  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  html, body {
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 210mm !important;
    min-height: 297mm !important;
  }

  .toolbar-container, .toast {
    display: none !important;
  }

  .cv-wrapper {
    max-width: 210mm !important;
    width: 210mm !important;
    margin: 0 !important;
    box-shadow: none !important;
  }

  .cv-page {
    box-shadow: none !important;
    border-radius: 0 !important;
    width: 210mm !important;
    min-height: 297mm !important;
  }

  .cv-header {
    padding: 20px 30px 16px !important;
  }

  .sidebar {
    padding: 20px 16px 24px 20px !important;
  }

  .avatar-frame {
    width: 160px !important;
    height: 195px !important;
    box-shadow: none !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    background: #ffffff !important;
  }

  .placeholder-hint {
    display: none !important;
  }

  .main-content {
    padding: 20px 24px 24px 24px !important;
    gap: 16px !important;
  }

  .main-section {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .project-card {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  [contenteditable="true"] {
    outline: none !important;
    background-color: transparent !important;
  }
}
