/* ========================================
   CSS Custom Properties - Màu đỏ trắng sen
   ======================================== */
:root {
  /* Màu sắc chủ đạo: Đỏ sen (lotus red) & Trắng */
  --color-lotus-red: #c0392b;
  --color-lotus-red-dark: #a93226;
  --color-lotus-red-light: #e74c3c;
  --color-lotus-red-pale: #fadbd8;
  --color-lotus-red-muted: #d98880;

  --color-white: #ffffff;
  --color-off-white: #fdfbfb;
  --color-cream: #faf8f5;

  --color-text-primary: #1a1a1a;
  --color-text-secondary: #3d3d3d;
  --color-text-muted: #6b6b6b;
  --color-text-on-red: #ffffff;

  --color-border: #e8e0dc;
  --color-border-strong: #d4c8c0;
  --color-border-focus: #c0392b;

  --color-success: #27ae60;
  --color-warning: #e67e22;

  /* Typography - Font chữ Việt Nam hóa */
  --font-heading: 'Libre Baskerville', Georgia, serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --text-xs: 0.7rem;      /* 11.2px */
  --text-sm: 0.8125rem;   /* 13px */
  --text-base: 0.9375rem; /* 15px */
  --text-lg: 1.0625rem;   /* 17px */
  --text-xl: 1.25rem;     /* 20px */
  --text-2xl: 1.5rem;     /* 24px */
  --text-3xl: 1.875rem;   /* 30px */
  --text-4xl: 2.25rem;    /* 36px */

  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;

  --leading-tight: 1.25;
  --leading-snug: 1.4;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  /* Khoảng cách */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */

  /* Bố cục */
  --sidebar-width: 290px;
  --content-max-width: 780px;
  --container-padding: var(--space-6);

  /* Bo góc */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Đổ bóng */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow-md: 0 4px 12px -2px rgb(192 57 43 / 0.1), 0 2px 6px -2px rgb(192 57 43 / 0.06);
  --shadow-lg: 0 12px 24px -4px rgb(192 57 43 / 0.12), 0 6px 12px -4px rgb(192 57 43 / 0.08);
  --shadow-xl: 0 20px 40px -6px rgb(192 57 43 / 0.15), 0 10px 20px -6px rgb(192 57 43 / 0.1);

  /* Chuyển động */
  --transition-fast: 120ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;

  /* Z-index */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal: 300;
  --z-toast: 400;
}

/* Chế độ tối - giữ nguyên tone đỏ sen */
@media (prefers-color-scheme: dark) {
  :root {
    --color-lotus-red: #e74c3c;
    --color-lotus-red-dark: #c0392b;
    --color-lotus-red-light: #ec7063;
    --color-lotus-red-pale: #4a1a18;
    --color-lotus-red-muted: #8b3a33;

    --color-white: #1a1a1a;
    --color-off-white: #1f1f1f;
    --color-cream: #252525;

    --color-text-primary: #f5f0ed;
    --color-text-secondary: #d4c8c0;
    --color-text-muted: #9a8d85;
    --color-text-on-red: #ffffff;

    --color-border: #3d332e;
    --color-border-strong: #5a4d45;
    --color-border-focus: #e74c3c;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
    --shadow-md: 0 4px 12px -2px rgb(0 0 0 / 0.3), 0 2px 6px -2px rgb(0 0 0 / 0.2);
    --shadow-lg: 0 12px 24px -4px rgb(0 0 0 / 0.4), 0 6px 12px -4px rgb(0 0 0 / 0.3);
    --shadow-xl: 0 20px 40px -6px rgb(0 0 0 / 0.5), 0 10px 20px -6px rgb(0 0 0 / 0.4);
  }
}

/* ========================================
   Reset & Base
   ======================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-cream);
  min-height: 100vh;
}

/* Link chung */
a {
  color: var(--color-lotus-red);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-lotus-red-dark);
}

a:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ========================================
   Layout
   ======================================== */
.cv-container {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  max-width: 1100px;
  margin: 0 auto;
  background: var(--color-white);
  box-shadow: var(--shadow-xl);
}

/* ========================================
   Sidebar
   ======================================== */
.sidebar {
  background: var(--color-lotus-red);
  color: var(--color-text-on-red);
  padding: var(--space-8) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-7);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.profile-section {
  text-align: center;
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-lotus-red-muted);
}

.avatar-wrapper {
  margin: 0 auto var(--space-4);
}

.avatar-placeholder {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  color: var(--color-lotus-red);
  box-shadow: var(--shadow-lg);
  border: 4px solid var(--color-lotus-red-light);
}

.name {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--color-text-on-red);
  margin-bottom: var(--space-1);
  letter-spacing: -0.01em;
  text-shadow: 0 2px 4px rgb(0 0 0 / 0.15);
}

.title {
  font-size: var(--text-lg);
  font-weight: var(--font-medium);
  color: var(--color-lotus-red-pale);
  margin-bottom: var(--space-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.location {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-lotus-red-pale);
  opacity: 0.9;
}

.location svg {
  flex-shrink: 0;
  opacity: 0.8;
}

/* Section title trong sidebar */
.section-title {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-lotus-red-pale);
  opacity: 0.85;
  margin-bottom: var(--space-3);
}

/* Contact */
.contact-nav,
.skills-nav,
.languages-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-lotus-red-pale);
  line-height: var(--leading-snug);
  transition: color var(--transition-fast);
}

.contact-item svg {
  flex-shrink: 0;
  margin-top: 2px;
  opacity: 0.9;
}

.contact-item a {
  color: inherit;
  word-break: break-all;
  transition: color var(--transition-fast);
}

.contact-item a:hover,
.contact-item a:focus {
  color: var(--color-white);
}

/* Skills - Danh sách thay vì tags */
.skills-categories {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.skill-category h3 {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-lotus-red-pale);
  opacity: 0.8;
  margin-bottom: var(--space-2);
}

.skill-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.skill-list li {
  font-size: var(--text-sm);
  font-weight: var(--font-normal);
  color: var(--color-text-on-red);
  padding: var(--space-1) 0;
  padding-left: var(--space-4);
  position: relative;
  opacity: 0.95;
}

.skill-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-white);
  opacity: 0.7;
}

/* Languages */
.language-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.language-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-sm);
  padding: var(--space-2) 0;
}

.lang-name {
  font-weight: var(--font-medium);
  color: var(--color-text-on-red);
}

.lang-level {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  text-transform: capitalize;
  background: var(--color-white);
  color: var(--color-lotus-red);
  opacity: 0.9;
}

.lang-level.native {
  background: var(--color-white);
  color: var(--color-lotus-red);
}

.lang-level.fluent {
  background: var(--color-lotus-red-light);
  color: var(--color-white);
}

.lang-level.intermediate {
  background: var(--color-lotus-red-muted);
  color: var(--color-white);
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
  padding: var(--space-10) var(--space-8);
  max-width: var(--content-max-width);
  margin-left: auto;
}

.section {
  margin-bottom: var(--space-10);
}

.section:last-of-type {
  margin-bottom: 0;
}

.section-heading {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-3);
  position: relative;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.section-heading::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 50px;
  height: 3px;
  background: linear-gradient(90deg, var(--color-lotus-red), var(--color-lotus-red-light));
  border-radius: 2px;
}

.section-heading::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 60px;
  width: 100%;
  max-width: 200px;
  height: 1px;
  background: var(--color-border);
}

/* Summary */
.summary {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--color-text-secondary);
  text-align: justify;
}

.summary strong {
  color: var(--color-text-primary);
  font-weight: var(--font-semibold);
}

/* ========================================
   Experience
   ======================================== */
.experience-item {
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--color-border);
}

.experience-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.experience-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.job-title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
}

.company {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  font-weight: var(--font-medium);
}

.date-range {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-lotus-red);
  background: var(--color-lotus-red-pale);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid var(--color-lotus-red-muted);
}

.achievements {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding-left: var(--space-1);
}

.achievements li {
  position: relative;
  padding-left: var(--space-5);
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
}

.achievements li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-lotus-red);
  box-shadow: 0 0 0 3px var(--color-lotus-red-pale);
}

.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tech-stack span {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  background: var(--color-cream);
  color: var(--color-text-secondary);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  transition: all var(--transition-fast);
}

.tech-stack span:hover {
  background: var(--color-lotus-red-pale);
  color: var(--color-lotus-red);
  border-color: var(--color-lotus-red-muted);
}

/* ========================================
   Projects
   ======================================== */
.project-item {
  margin-bottom: var(--space-6);
  padding: var(--space-6);
  background: var(--color-cream);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-normal);
}

.project-item:hover {
  border-color: var(--color-lotus-red-muted);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.project-name {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--color-text-primary);
}

.project-links {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.project-links a {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-lotus-red);
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--color-lotus-red-muted);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.project-links a:hover,
.project-links a:focus {
  background: var(--color-lotus-red);
  color: var(--color-white);
  border-color: var(--color-lotus-red);
}

.project-desc {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-3);
  text-align: justify;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.project-tech span {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  background: var(--color-lotus-red-pale);
  color: var(--color-lotus-red);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-lotus-red-muted);
}

/* ========================================
   Education
   ======================================== */
.education-item {
  padding-left: var(--space-1);
}

.degree {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
}

.school {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  font-weight: var(--font-medium);
  margin-bottom: var(--space-2);
}

.education-meta {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.gpa {
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
}

/* ========================================
   Certificates
   ======================================== */
.certificates-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.certificates-list li {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
  padding-left: var(--space-5);
  position: relative;
}

.certificates-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 0 3px rgb(39 174 96 / 0.15);
}

.certificates-list strong {
  color: var(--color-text-primary);
  font-weight: var(--font-semibold);
}

/* ========================================
   Footer
   ======================================== */
.cv-footer {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-6);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  background: var(--color-white);
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
  .skip-link { display: none; }

  .cv-container {
    display: block;
    max-width: none;
    box-shadow: none;
    background: white;
  }

  .sidebar {
    position: static;
    height: auto;
    page-break-after: avoid;
    background: var(--color-lotus-red) !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .main-content {
    max-width: none;
    margin: 0;
    padding: var(--space-6);
  }

  .section {
    page-break-inside: avoid;
  }

  .experience-item,
  .project-item {
    page-break-inside: avoid;
  }

  .cv-footer {
    display: none;
  }

  a {
    text-decoration: none;
    color: inherit;
  }

  .tech-stack span,
  .project-tech span,
  .skill-list li::before {
    border: 1px solid currentColor;
    background: transparent !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .project-item {
    background: white !important;
    border: 1px solid #ccc;
  }

  .date-range {
    background: #f5eeec !important;
    color: var(--color-lotus-red) !important;
    border: 1px solid var(--color-lotus-red-muted) !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .lang-level {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 900px) {
  .cv-container {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-6);
    padding: var(--space-6);
  }

  .profile-section {
    flex: 1;
    min-width: 220px;
    text-align: left;
    border-bottom: none;
    border-right: 1px solid var(--color-lotus-red-muted);
    padding-bottom: 0;
    padding-right: var(--space-6);
  }

  .avatar-wrapper {
    margin: 0 0 var(--space-4);
  }

  .avatar-placeholder {
    width: 80px;
    height: 80px;
  }

  .name {
    font-size: var(--text-2xl);
  }

  .contact-nav,
  .skills-nav,
  .languages-nav {
    flex: 1;
    min-width: 200px;
  }

  .main-content {
    padding: var(--space-6);
  }
}

@media (max-width: 600px) {
  :root {
    --text-base: 0.875rem;  /* 14px */
    --text-lg: 1rem;        /* 16px */
    --text-xl: 1.125rem;    /* 18px */
    --text-2xl: 1.375rem;   /* 22px */
    --text-3xl: 1.75rem;    /* 28px */
  }

  .sidebar {
    flex-direction: column;
  }

  .profile-section {
    border-right: none;
    border-bottom: 1px solid var(--color-lotus-red-muted);
    padding-right: 0;
    padding-bottom: var(--space-6);
    text-align: center;
  }

  .avatar-wrapper {
    margin: 0 auto var(--space-4);
  }

  .experience-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .date-range {
    align-self: flex-start;
  }

  .project-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .project-links {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ========================================
   Accessibility
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-lotus-red);
  color: var(--color-white);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  z-index: var(--z-toast);
  text-decoration: none;
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
}

.skip-link:focus {
  top: var(--space-4);
}

/* High Contrast */
@media (prefers-contrast: high) {
  :root {
    --color-border: currentColor;
    --color-border-strong: currentColor;
  }

  .tech-stack span,
  .project-tech span,
  .skill-list li::before {
    border: 2px solid currentColor;
  }

  .avatar-placeholder {
    border: 4px solid currentColor;
  }

  .date-range {
    border: 2px solid currentColor;
  }
}

/* ========================================
   Selection color
   ======================================== */
::selection {
  background: var(--color-lotus-red);
  color: var(--color-white);
}

::-moz-selection {
  background: var(--color-lotus-red);
  color: var(--color-white);
}