:root {
  --primary-color: #1d4ed8;
  --text-dark: #111827;
  --text-light: #4b5563;
  --bg-white: #ffffff;
  --border-color: #e5e7eb;
  --bg-light: #f9fafb;
}

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

body {
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #e5e7eb;
  color: var(--text-dark);
  line-height: 1.4;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.back-button {
  position: fixed;
  top: 20px;
  left: 20px;
  width: 45px;
  height: 45px;
  background: white;
  border-radius: 8px; /* Rounded square */
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dark);
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  z-index: 100;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border-color);
  overflow: hidden; /* For animation containment */
}

.back-button i {
  transition: transform 0.3s ease;
}

/* Animation for "going back" flow */
@keyframes backFlow {
  0% {
    transform: translateX(0);
    opacity: 1;
  }
  35% {
    transform: translateX(-12px);
    opacity: 0;
  }
  40% {
    transform: translateX(12px);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

.back-button:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 10px 20px rgba(29, 78, 216, 0.2);
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.back-button:hover i {
  animation: backFlow 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.container {
  width: 210mm;
  height: auto; /* Fit content on web */
  background: white;
  padding: 10mm;
  box-shadow: 0 0 15px rgba(0,0,0,0.1);
  position: relative;
  overflow: hidden;
  margin-bottom: 0;
  border-radius: 15px; /* Rounded A4 corners */
}

/* Header */
.header {
  display: flex;
  gap: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 15px;
  position: relative;
}

.profile-section {
  display: flex;
  gap: 20px;
  width: 100%;
}

.profile-image {
  width: 100px;
  height: 100px;
  flex-shrink: 0;
}

.profile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--bg-light);
}

.profile-info {
  flex-grow: 1;
}

.name {
  font-size: 24pt;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 2px;
  line-height: 1.1;
}

.title {
  font-size: 12pt;
  color: var(--primary-color);
  font-weight: 500;
  margin-bottom: 10px;
}

.contact-info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 15px;
  font-size: 9pt;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-light);
}

.contact-item i {
  color: var(--primary-color);
  width: 14px;
  text-align: center;
}

.contact-item a {
  color: inherit;
  text-decoration: none;
}

.actions {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.btn {
  background: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 9pt;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.btn:hover {
  transform: translateY(-1px);
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Layout */
.main-content {
  display: grid;
  grid-template-columns: 65% 32%; /* Left column wider */
  gap: 3%;
  align-items: start;
}

.col-left, .col-right {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Sections */
.section {
  margin-bottom: 5px;
}

.section-title {
  font-size: 11pt;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dark);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title i {
  color: var(--primary-color);
}

.section-content {
  font-size: 9.5pt;
}

/* Text & Lists */
.about-text {
  text-align: justify;
  color: var(--text-light);
  line-height: 1.4;
}

/* Experience & Education Items */
.experience-item, .education-item {
  margin-bottom: 12px;
}

.experience-item:last-child, .education-item:last-child {
  margin-bottom: 0;
}

.experience-header, .education-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}

.job-title, .degree {
  font-weight: 700;
  color: var(--text-dark);
  font-size: 10pt;
}

.job-duration, .education-duration {
  font-size: 8.5pt;
  color: var(--text-light);
  white-space: nowrap;
}

.company-info, .school-info {
  display: flex;
  justify-content: space-between;
  font-size: 9pt;
  color: var(--text-light);
  margin-bottom: 4px;
}

.company-name, .school-name {
  font-weight: 500;
  color: var(--primary-color);
}

.job-responsibilities {
  list-style: none;
  padding-left: 0;
}

.job-responsibilities li {
  position: relative;
  padding-left: 12px;
  margin-bottom: 3px;
  font-size: 9pt;
  color: var(--text-light);
}

.job-responsibilities li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--primary-color);
}

/* Skills */
.skills-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skill-category-title {
  font-size: 9pt;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--text-dark);
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.skill-tag {
  font-size: 9pt;
  color: var(--text-light);
  border-bottom: 1px dotted var(--border-color);
}

/* Certifications & Languages */
.certifications-grid, .languages-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.certification-item, .language-item {
  padding: 0;
  border: none;
  background: none;
  margin-bottom: 2px;
}

.cert-info {
  display: flex;
  flex-direction: column;
}

.cert-name, .language-name {
  font-weight: 600;
  font-size: 9.5pt;
  color: var(--text-dark);
  margin-bottom: 1px;
}

.cert-date {
  font-size: 8.5pt;
  color: var(--text-light);
  margin-bottom: 1px;
}

.cert-issuer, .language-level {
  font-size: 9pt;
  color: var(--text-light);
  display: block;
}

/* Projects */
.projects-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project-card {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.project-card:last-child {
  border-bottom: none;
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.project-title {
  font-size: 10pt;
  font-weight: 600;
  color: var(--text-dark);
}

.project-links a {
  color: var(--primary-color);
  font-size: 9pt;
}

.project-description {
  font-size: 9pt;
  color: var(--text-light);
  margin-bottom: 4px;
  line-height: 1.3;
}

.project-technologies {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.tech-tag {
  font-size: 8pt;
  background: #eff6ff;
  color: var(--primary-color);
  padding: 1px 5px;
  border-radius: 3px;
}

/* Mobile Responsiveness */
@media screen and (max-width: 768px) {
  body {
    padding: 0;
    height: auto;
    display: block;
  }

  .container {
    width: 100%;
    height: auto;
    padding: 20px;
    box-shadow: none;
  }

  .main-content {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .header {
    flex-direction: column;
    text-align: center;
  }

  .profile-section {
    flex-direction: column;
    align-items: center;
  }

  .contact-info {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  
  .actions {
    position: static;
    margin-top: 14px;
    justify-content: center;
    width: 100%;
  }
}

/* Print Styles */
@media print {
  @page {
    margin: 0;
    size: A4;
  }
  
  body {
    background: white;
    padding: 0;
    margin: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    display: block; /* Reset flex display for print */
  }

  .back-button {
    display: none !important;
  }

  .actions {
    display: none !important;
  }

  .container {
    width: 210mm;
    height: 297mm;
    box-shadow: none;
    margin: 0 auto;
    padding: 10mm; /* Standard print margin */
    border-radius: 0;
    overflow: hidden;
  }

  .main-content {
    display: grid !important;
    grid-template-columns: 65% 32% !important;
    gap: 3% !important;
  }

  .col-left, .col-right {
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
  }

  /* Force Desktop Header Layout for Print */
  .header {
    flex-direction: row !important;
    text-align: left !important;
    padding-bottom: 15px;
    margin-bottom: 15px;
  }

  .profile-section {
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 20px !important;
  }

  .profile-image {
    width: 100px !important;
    height: 100px !important;
    margin-bottom: 0 !important;
  }

  .profile-info {
    width: auto !important;
  }

  .contact-info {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 4px 15px !important;
    justify-items: start !important;
  }

  .name {
    font-size: 24pt !important;
  }

  /* Ensure links are black/dark for print readability */
  a {
    color: inherit;
    text-decoration: none;
  }
}
