:root {
  /* Light Mode */
  --light-bg: #f8f9fc;
  --light-card: #ffffff;
  --light-text: #1e293b;
  --light-accent: #2563eb;
  --light-border: #e2e8f0;
  --light-shadow: rgba(0, 0, 0, 0.05);
  --light-remote: #0d9488;

  /* Dark Mode */
  --dark-bg: #121826;
  --dark-card: #1e293b;
  --dark-text: #e2e8f0;
  --dark-accent: #60a5fa;
  --dark-border: #334155;
  --dark-shadow: rgba(0, 0, 0, 0.3);
  --dark-remote: #14b8a6;
}

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

body {
  font-family: "Inter", sans-serif;
  background: var(--light-bg);
  color: var(--light-text);
  line-height: 1.6;
  transition: background 0.4s ease, color 0.4s ease;
  overflow-x: hidden;
  padding-right: 66px; /* 48px (toggle width) + 18px (right offset) */
}

body.dark-mode {
  background: var(--dark-bg);
  color: var(--dark-text);
}

/* Center the container and add equal padding */
.container {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 16px;
  padding-right: 16px;
  box-sizing: border-box;
}

@media (max-width: 600px) {
  .container {
    max-width: 100%;
    padding-left: 10px;
    padding-right: 10px;
  }

  body {
    padding-right: 30px; 
  }
}

/* Header Styles */
header {
  text-align: center;
  padding: 40px 20px 30px;
  position: relative;
  margin-bottom: 30px;
}

h1 {
  font-size: 2.2rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--light-accent);
}

.dark-mode h1 {
  color: var(--dark-accent);
}

.subtitle {
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
  opacity: 0.8;
  font-weight: 400;
}

@media (max-width: 600px) {
  header {
    text-align: center;
    padding-left: 0;
    padding-right: 0;
  }
  h1 {
    text-align: center;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    display: block;
  }
  .subtitle {
    text-align: center;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    display: block;
  }
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  top: 18px;
  right: 14px;
  width: 44px;
  height: 44px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  cursor: pointer;
  border: none;
  transition: background 0.2s, box-shadow 0.2s;
  font-size: 1.6rem;
  color: #fbbf24; /* Sun yellow */
}

.theme-toggle i {
  font-size: 1.7rem;
  pointer-events: none;
}

.theme-toggle:hover {
  background: #f3f4f6;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.08);
}

body.dark-mode .theme-toggle {
  background: #23272f;
  color: #a7a3a3;
  border: 1px solid #334155;
}

@media (max-width: 600px) {
  .theme-toggle {
    top: 10px;
    right: 6px;
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
  }

  .theme-toggle i {
    font-size: 1.3rem;
  }
}

/* Timeline Styles */
.timeline {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: 30px 0;
}

/* Center line - placed behind dots */
.timeline::before {
  content: "";
  position: absolute;
  width: 2px;
  background: var(--light-border);
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: -1;
}

.dark-mode .timeline::before {
  background: var(--dark-border);
}

.timeline-item {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 50px;
  position: relative;
  width: 100%;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s ease;
}

.timeline-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline-item:nth-child(odd) {
  justify-content: flex-end;
}

.timeline-item-content {
  width: 46%;
  background: var(--light-card);
  border: 1px solid var(--light-border);
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  position: relative;
  transition: all 0.3s ease;
  z-index: 3;
}

.dark-mode .timeline-item-content {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.timeline-item-content:hover {
  border-color: var(--light-accent);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.dark-mode .timeline-item-content:hover {
  border-color: var(--dark-accent);
}

/* Timeline Dot - Positioned exactly on the central line */
.timeline-dot {
  position: absolute;
  top: 30px;
  width: 18px;
  height: 18px;
  background: #2563eb;
  border: none;
  border-radius: 50%;
  z-index: 100;
  left: calc(50% - 9px);
  transition: all 0.3s ease;
}

.dark-mode .timeline-dot {
  background: #3b82f6;
}

.timeline-item:hover .timeline-dot {
  transform: scale(1.3);
  background: #1d4ed8;
  z-index: 100;
}

.dark-mode .timeline-item:hover .timeline-dot {
  background: #2563eb;
  z-index: 100;
}

/* Content Styling */
.timeline-item-content h3 {
  font-size: 1.2rem;
  margin-bottom: 10px;
  color: var(--light-text);
  font-weight: 600;
}

.dark-mode .timeline-item-content h3 {
  color: var(--dark-text);
}

.company {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  gap: 10px;
}

.company i {
  font-size: 1rem;
  color: var(--light-accent);
}

.dark-mode .company i {
  color: var(--dark-accent);
}

.company h4 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--light-accent);
}

.dark-mode .company h4 {
  color: var(--dark-accent);
}

.details-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center;
}

.duration {
  background: rgba(37, 99, 235, 0.1);
  display: inline-flex;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  border: 1px solid rgba(37, 99, 235, 0.2);
  color: var(--light-text);
  align-items: center;
  gap: 6px;
}

.dark-mode .duration {
  background: rgba(96, 165, 250, 0.1);
  border: 1px solid rgba(96, 165, 250, 0.2);
  color: var(--dark-text);
}

.remote-badge {
  background: rgba(13, 148, 136, 0.1);
  color: var(--light-remote);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(13, 148, 136, 0.2);
}

.dark-mode .remote-badge {
  background: rgba(20, 184, 166, 0.1);
  color: var(--dark-remote);
  border: 1px solid rgba(20, 184, 166, 0.2);
}

.cert-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.cert-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--light-card);
  border: 1px solid var(--light-border);
  border-radius: 6px;
  color: var(--light-text);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.dark-mode .cert-link {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  color: var(--dark-text);
}

.cert-link i {
  margin-right: 6px;
  color: var(--light-accent);
}

.dark-mode .cert-link i {
  color: var(--dark-accent);
}

.cert-link:hover {
  background: rgba(37, 99, 235, 0.1);
  border-color: var(--light-accent);
}

.dark-mode .cert-link:hover {
  background: rgba(96, 165, 250, 0.1);
  border-color: var(--dark-accent);
}

/* Certificate Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(3px);
}

.modal.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  position: relative;
  background: transparent;
  border-radius: 12px;
  overflow: visible;
  width: 95%;
  max-width: 1000px;
  max-height: 95vh;
  box-shadow: none;
  transform: scale(0.95);
  transition: transform 0.4s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dark-mode .modal-content {
  background: transparent;
}

.modal.active .modal-content {
  transform: scale(1);
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.close-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

.modal-body {
  padding: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: transparent;
}

/* Style for mobile PDF fallback message */
.modal-body {
  background: #fff;
  color: #222;
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  max-width: 90vw;
  margin: 2em auto;
  padding: 2em 1em;
  font-family: "Inter", sans-serif;
  font-size: 1.1em;
  text-align: center;
}

/* Dark mode support */
body.dark-mode .modal-body {
  background: #23272f;
  color: #fff;
}

.certificate-img {
  max-width: 100%;
  max-height: 90vh;
  border: none;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  background: transparent;
  object-fit: contain;
  cursor: pointer;
}

#pdfCanvas {
  max-width: 100%;
  max-height: 85vh;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  background: white;
  display: block;
}

#pdfControls {
  margin-top: 10px;
  text-align: center;
  padding: 10px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.dark-mode #pdfControls {
  background: rgba(255, 255, 255, 0.1);
}

#pdfControls button {
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border: none;
  padding: 8px 16px;
  margin: 0 5px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

#pdfControls button:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.05);
}

#pdfControls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#pageInfo {
  color: var(--light-text);
  margin: 0 10px;
  font-size: 14px;
  font-weight: 500;
}

.dark-mode #pageInfo {
  color: var(--dark-text);
}

#certificateFrame {
  width: 90vw;
  height: 90vh;
  max-width: 1000px;
  max-height: 800px;
  border: none;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  background: white;
  display: none;
  overflow: auto;
  user-select: none;
  -webkit-overflow-scrolling: touch;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: transform;
  pointer-events: auto;
  touch-action: auto;
}

/* Footer */
footer {
  text-align: center;
  padding: 40px 20px 30px;
  margin-top: 30px;
  color: var(--light-text);
  font-size: 0.9rem;
  position: relative;
}

.dark-mode footer {
  color: var(--dark-text);
}

footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 2px;
  background: var(--light-border);
}

.dark-mode footer::before {
  background: var(--dark-border);
}

.footer-content {
  max-width: 500px;
  margin: 0 auto;
  padding-top: 25px;
}

/* Enhanced Mobile Download Interface */
.mobile-download-container {
  background: var(--light-card);
  border: 1px solid var(--light-border);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  max-width: 400px;
  margin: 2rem auto;
}

.dark-mode .mobile-download-container {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.mobile-download-icon {
  font-size: 3rem;
  color: var(--light-accent);
  margin-bottom: 1rem;
  display: block;
}

.dark-mode .mobile-download-icon {
  color: var(--dark-accent);
}

.mobile-download-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--light-text);
}

.dark-mode .mobile-download-title {
  color: var(--dark-text);
}

.mobile-download-subtitle {
  font-size: 0.9rem;
  color: var(--light-text);
  opacity: 0.7;
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

.dark-mode .mobile-download-subtitle {
  color: var(--dark-text);
}

.mobile-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--light-accent);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.dark-mode .mobile-download-btn {
  background: var(--dark-accent);
}

.mobile-download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.dark-mode .mobile-download-btn:hover {
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.3);
}

.mobile-download-btn i {
  font-size: 1.1rem;
}

/* Hide mobile download on larger screens */
@media (min-width: 769px) {
  .mobile-download-container {
    display: none !important;
  }
}

/* Improved Responsive Design */
@media (max-width: 1000px) {
  .timeline::before {
    left: 30px;
  }

  .timeline-item {
    justify-content: flex-start !important;
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 40px;
    padding-left: 60px;
  }

  .timeline-item-content {
    width: calc(100% - 60px);
    margin-left: 0;
  }

  .timeline-dot {
    left: 21px;
    top: 30px;
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 1.8rem;
  }

  .subtitle {
    font-size: 0.95rem;
  }

  .timeline::before {
    left: 25px;
  }

  .timeline-item {
    padding-left: 35px; /* reduced from 55px */
    margin-bottom: 35px;
  }

  .timeline-item-content {
    width: calc(100% - 35px); /* increased from 100% - 55px */
    padding: 20px;
  }

  .timeline-dot {
    left: 17px;
    top: 25px;
    width: 16px;
    height: 16px;
  }

  .cert-links {
    flex-direction: column;
  }

  .cert-link {
    justify-content: center;
  }

  .modal-content {
    max-width: 95%;
  }

  #pdfCanvas {
    width: 100% !important;
    max-width: 95vw !important;
    max-height: 75vh !important;
    min-height: 400px !important;
  }

  #pdfControls {
    width: 100%;
    max-width: 95vw;
    margin-top: 15px;
  }

  #pdfControls button {
    padding: 10px 20px;
    font-size: 14px;
  }

  #pageInfo {
    font-size: 16px;
    margin: 0 15px;
  }
}

@media (max-width: 600px) {
  .modal-content {
    max-width: 98vw;
    width: 98vw;
    max-height: 98vh;
    padding: 0;
  }

  #pdfCanvas {
    width: 96vw !important;
    height: 80vh !important;
    max-width: 96vw !important;
    max-height: 80vh !important;
    min-height: 400px !important;
    border-radius: 6px !important;
    background: white !important;
    display: block !important;
    -webkit-transform: translateZ(0) !important;
    transform: translateZ(0) !important;
    -webkit-backface-visibility: hidden !important;
    backface-visibility: hidden !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
    visibility: visible !important;
    opacity: 1 !important;
    isolation: isolate !important;
  }

  .certificate-img {
    width: 96vw !important;
    height: 80vh !important;
    max-width: 96vw !important;
    max-height: 80vh !important;
    min-height: 400px !important;
    border-radius: 6px;
    object-fit: contain;
    background: transparent !important;
    cursor: pointer;
  }

  #pdfControls {
    max-width: 96vw;
    padding: 8px;
  }

  #pdfControls button {
    padding: 8px 16px;
    font-size: 13px;
    margin: 0 3px;
  }

  #pageInfo {
    font-size: 14px;
    margin: 0 8px;
  }
}

@media (max-width: 400px) {
  .theme-toggle {
    right: 2px;
  }

  #pdfCanvas {
    width: 98vw !important;
    height: 65vh !important;
    max-width: 98vw !important;
    max-height: 65vh !important;
    min-height: 300px !important;
    visibility: visible !important;
    opacity: 1 !important;
    isolation: isolate !important;
  }

  .certificate-img {
    width: 98vw !important;
    height: 65vh !important;
    max-width: 98vw !important;
    max-height: 65vh !important;
    min-height: 300px !important;
    cursor: pointer;
  }

  #pdfControls {
    max-width: 98vw;
    padding: 6px;
  }

  #pdfControls button {
    padding: 6px 12px;
    font-size: 12px;
    margin: 0 2px;
  }

  #pageInfo {
    font-size: 12px;
    margin: 0 5px;
  }
}

@media (max-width: 360px) {
  .timeline::before {
    left: 18px;
  }

  .timeline-item {
    padding-left: 40px;
    margin-bottom: 25px;
  }

  .timeline-item-content {
    width: calc(100% - 40px);
    padding: 15px;
    font-size: 0.9rem;
  }

  .timeline-dot {
    left: 10px;
    top: 20px;
    width: 12px;
    height: 12px;
  }

  .timeline-item-content h3 {
    font-size: 1.1rem;
  }

  #pdfCanvas {
    width: 98vw !important;
    height: 70vh !important;
    max-width: 98vw !important;
    max-height: 70vh !important;
    min-height: 300px !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .certificate-img {
    width: 98vw !important;
    height: 70vh !important;
    max-width: 98vw !important;
    max-height: 70vh !important;
    min-height: 300px !important;
    cursor: pointer;
  }
}

/* Theme Toggle Switch */
/* Theme Toggle Switch */
.theme-toggle-switch {
  position: fixed;       /* stays fixed on scroll */
  top: 16px;             /* distance from top */
  right: 16px;           /* distance from right */
  width: 50px;
  height: 26px;
  background: #ccc;
  border: none;
  border-radius: 13px;
  cursor: pointer;
  outline: none;
  z-index: 9999;         /* ensure it stays on top */
  display: flex;
  align-items: center;
  padding: 0;
  transition: background 0.3s;
}

.toggle-slider {
  width: 24px;
  height: 24px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: transform 0.3s, background 0.3s;
  transform: translateX(2px);
}

.theme-toggle-switch.active {
  background: #3b82f6; /* dark mode color */
}

.theme-toggle-switch.active .toggle-slider {
  transform: translateX(24px);
  background: #23272f;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .theme-toggle-switch {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 22px;
  }
  .toggle-slider {
    width: 18px;
    height: 18px;
    transform: translateX(2px);
  }
  .theme-toggle-switch.active .toggle-slider {
    transform: translateX(20px);
  }
}


@media (max-width: 600px) {
  .timeline-item {
    padding-left: 50px; /* more space between line and box */
  }
  .timeline-item-content {
    width: calc(100% - 0px);
  }
}

#preloader {
  position: fixed;
  z-index: 9999;
  inset: 0;
  background: #f8f9fc;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s cubic-bezier(.4,0,.2,1);
}

body.dark-mode #preloader {
  background: #121826;
}

.preloader-logo {
  display: flex;
  align-items: center;
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  font-weight: 700;
  font-size: 5rem;
  color: #2563eb;
  letter-spacing: 0.1em;
  user-select: none;
  opacity: 0.92;
  animation: preloader-fadein 1s cubic-bezier(.4,0,.2,1);
}

body.dark-mode .preloader-logo {
  color: #60a5fa;
  opacity: 1;
}

.preloader-angle {
  font-size: 1em;
  animation: preloader-angle-bounce 1.2s infinite alternate;
}

.preloader-slash {
  margin: 0 0.2em;
  font-size: 1.2em;
  animation: preloader-slash-bounce 1.2s infinite alternate;
}

@keyframes preloader-angle-bounce {
  0% { transform: translateY(0);}
  100% { transform: translateY(-12px);}
}
@keyframes preloader-slash-bounce {
  0% { transform: scale(1);}
  100% { transform: scale(1.25);}
}

@keyframes preloader-fadein {
  from { opacity: 0; transform: scale(0.9);}
  to { opacity: 1; transform: scale(1);}
}

/* Responsive: smaller logo on small screens */
@media (max-width: 600px) {
  .preloader-logo {
    font-size: 4rem;
  }
}