/* ==========================================================================
   CV2 - Responsive Curriculum Vitae Stylesheet
   ========================================================================== */

:root {
  --bg-page: linear-gradient(135deg, #f0f1f3 0%, #c9cdd4 100%);
  --bg-card: #ffffff;
  --bg-sidebar: #dddddd;
  --text-main: #1f2937;
  --text-muted: #4b5563;
  --text-dim: #6b7280;
  --accent-blue: #1F4788;
  --accent-orange: #ea580c;
  --badge-bg: #444444;
  --badge-text: #eeeeee;
  --border-color: #000000;
  --font-sans: 'Arimo', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html {
  height: 100%;
}

body {
  min-height: 100%;
  background: var(--bg-page);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: 30px 15px 40px 15px;
}

/* --------------------------------------------------------------------------
   Floating Action Toolbar (PDF & Print)
   -------------------------------------------------------------------------- */
.action-toolbar {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 30px;
  padding: 6px 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-main);
  text-decoration: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.toolbar-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--accent-orange);
}

.toolbar-btn .icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Main CV Document (Desktop A4 Simulation)
   -------------------------------------------------------------------------- */
.cv-page {
  position: relative;
  width: 21cm;
  height: 29.7cm;
  min-height: 29.7cm;
  margin: 0 auto;
  background: var(--bg-card);
  box-shadow: 0.2cm 0.2cm 0.5cm rgba(0, 0, 0, 0.3);
  border-radius: 2px;
  display: flex;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Sidebar (Left Grey Area)
   -------------------------------------------------------------------------- */
.cv-sidebar {
  width: 7.2cm;
  flex-shrink: 0;
  background-color: var(--bg-sidebar);
  padding: 34px 26px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.cv-sidebar-inner {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 16px;
  height: auto;
}

.sidebar-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.profile-photo {
  width: 100%;
  max-width: 216px;
  border-radius: 10px;
  margin: 0 auto 12px auto;
  display: block;
}

.mobile-name-block {
  display: none;
}

.contact-list {
  width: 100%;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13.5px;
  line-height: 1.35;
}

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

.contact-item .icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-dim);
}

.contact-link {
  color: var(--text-main);
  text-decoration: none;
  transition: color 0.18s ease;
}

.contact-link:hover {
  color: var(--accent-orange);
}

.mobile-cv-download {
  display: none;
}

.sidebar-credentials {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

/* Section Dividers in Sidebar */
.section-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px 0;
}

.section-divider .line {
  flex: 1;
  border-bottom: 2px solid var(--border-color);
  height: 0;
}

.section-divider .title {
  font-size: 15px;
  font-weight: bold;
  color: #000000;
  white-space: nowrap;
}

/* Credentials */
.cred-entry {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 13.5px;
  line-height: 1.35;
  margin-bottom: 6px;
}

.cred-entry .bullet {
  font-size: 11px;
  line-height: 1.5;
  color: #000000;
}

.cred-entry .subtext {
  font-size: 13px;
  color: #333333;
}

/* Highlights */
.highlight-lead {
  color: #ea580c;
  font-weight: bold;
}

/* --------------------------------------------------------------------------
   Main Content Area (Work Experience)
   -------------------------------------------------------------------------- */
.cv-main {
  flex: 1;
  padding: 34px 34px 28px 34px;
  display: flex;
  flex-direction: column;
  text-align: justify;
  hyphens: auto;
}

.desktop-header {
  text-align: center;
  margin-bottom: 2px;
}

.candidate-name {
  font-size: 40px;
  font-weight: bold;
  color: #000000;
  letter-spacing: -0.01em;
}

.main-divider {
  margin: 6px 0 14px 0;
}

.main-divider .title {
  font-size: 16px;
}

/* Job Cards */
.experience-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.job-card {
  display: flex;
  flex-direction: column;
}

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

.job-company {
  font-size: 15.5px;
  font-weight: bold;
  color: #000000;
}

.job-tenure {
  font-weight: bold;
}

.company-logo {
  height: 16px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
}

.dual-logos {
  display: flex;
  align-items: center;
}

.logo-offset {
  margin-left: 18px;
}

.job-roles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13.5px;
  margin-bottom: 6px;
}

.role-item {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-weight: 500;
  color: #000000;
}

.role-item .bullet {
  font-size: 10px;
}

.role-dates {
  font-weight: normal;
  color: #444444;
}

.job-description {
  font-size: 12.8px;
  line-height: 1.45;
  color: #333333;
  margin: 0;
  text-align: justify;
}

/* ==========================================================================
   TABLET RESPONSIVE VIEW (651px - 950px)
   ========================================================================== */
@media screen and (min-width: 476px) and (max-width: 950px) {
  html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body {
    padding: 16px 16px 40px 16px;
    background: #f3f4f6;
  }

  .action-toolbar {
    top: 14px;
    right: 16px;
  }

  .cv-page {
    width: 100%;
    max-width: 820px;
    height: auto;
    min-height: 0;
    overflow: visible;
    margin: 45px auto 20px auto;
    flex-direction: column;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  }

  .cv-sidebar {
    width: 100%;
    padding: 24px 26px;
    border-radius: 12px 12px 0 0;
  }

  .cv-sidebar-inner {
    display: grid;
    grid-template-columns: minmax(160px, 200px) 1fr;
    gap: 18px;
    align-items: start;
    height: auto;
  }

  .sidebar-credentials .section-divider {
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    margin: 12px 0 6px 0;
  }

  .sidebar-credentials .section-divider .line:first-child {
    display: none;
  }

  .sidebar-credentials .section-divider .line:last-child {
    flex: 0 0 35px;
    width: 35px;
  }

  .cv-main {
    padding: 26px 28px;
  }

  .candidate-name {
    font-size: 34px;
  }

  .job-description {
    font-size: 13.5px;
    line-height: 1.5;
  }
}

/* ==========================================================================
   MOBILE RESPONSIVE VIEW (<= 475px)
   ========================================================================== */
@media screen and (max-width: 475px) {
  html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body {
    padding: 0 0 40px 0;
    background: #ffffff;
  }

  .action-toolbar {
    display: none !important;
  }

  .cv-page {
    width: 100%;
    height: auto;
    min-height: 0;
    overflow: visible;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    flex-direction: column;
  }

  .cv-sidebar {
    width: 100%;
    padding: 24px 20px;
    background-color: var(--bg-sidebar);
  }

  .cv-sidebar-inner {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
  }

  .sidebar-profile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    width: 100%;
  }

  .profile-photo {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: top center;
    border-radius: 8px;
    margin-bottom: 14px;
    display: block;
  }

  .mobile-name-block {
    display: none;
  }

  .contact-list {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    font-size: 13.5px;
    width: 100%;
  }

  .mobile-cv-download {
    display: flex;
  }

  .sidebar-credentials {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }

  .cred-section {
    background: transparent;
    border-radius: 0;
    padding: 0;
    margin-bottom: 0;
    width: 100%;
  }

  .sidebar-credentials .section-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 12px 0 8px 0;
    width: 100%;
  }

  .sidebar-credentials .section-divider .line {
    flex: 1;
    border-bottom: 2px solid var(--border-color);
    height: 0;
    display: block;
  }

  .cred-body {
    width: 100%;
  }

  .cred-entry {
    width: 100%;
  }

  /* Main Work Experience Section */
  .cv-main {
    padding: 24px 20px 36px 20px;
    text-align: left;
    width: 100%;
  }

  .desktop-header {
    display: block;
    text-align: center;
    margin-bottom: 6px;
  }

  .candidate-name {
    font-size: 28px;
    font-weight: bold;
    color: #000000;
  }

  .main-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 8px 0 16px 0;
    width: 100%;
  }

  .main-divider .line {
    flex: 1;
    border-bottom: 2px solid var(--border-color);
    height: 0;
    display: block;
  }

  .experience-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
  }

  .job-card {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    width: 100%;
  }

  .job-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    width: 100%;
  }

  .job-company {
    font-size: 15.5px;
    font-weight: bold;
    color: #000000;
  }

  .company-logo {
    height: 18px;
    width: auto;
    object-fit: contain;
  }

  .job-roles {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13.5px;
    margin-bottom: 6px;
    width: 100%;
  }

  .job-description {
    font-size: 13.5px;
    line-height: 1.5;
    color: #333333;
    margin: 0;
    text-align: left;
    width: 100%;
  }
}

/* ==========================================================================
   PRINT STYLESHEET (Exact A4 Single Page Output)
   ========================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  html, body {
    width: 21cm;
    height: 29.7cm;
    margin: 0;
    padding: 0;
    background: #ffffff !important;
  }

  .action-toolbar {
    display: none !important;
  }

  .cv-page {
    width: 21cm !important;
    height: 29.7cm !important;
    min-height: 29.7cm !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
  }

  .cv-sidebar {
    width: 7.2cm !important;
    background-color: #dddddd !important;
    padding: 34px 26px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .cv-sidebar-inner {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    gap: 16px !important;
    height: auto !important;
  }

  .mobile-name-block {
    display: none !important;
  }

  .desktop-header {
    display: block !important;
  }

  .cv-main {
    flex: 1 !important;
    padding: 34px 34px 28px 34px !important;
    display: flex !important;
    flex-direction: column !important;
  }
}
