/**
 * @file window.css
 * @description Window rendering, title bars, and content areas.
 */

.os-window {
  position: absolute;
  background-color: var(--window-bg);
  border-radius: var(--radius-window);
  box-shadow: var(--shadow-window);
  display: flex;
  flex-direction: column;
  min-width: 400px;
  min-height: 250px;
  max-width: 90vw;
  max-height: 85vh;
}

.title-bar {
  height: 36px;
  background-color: var(--topbar-bg);
  border-bottom: 1px solid var(--border-light);
  border-radius: var(--radius-window) var(--radius-window) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  cursor: default;
  font-weight: 600;
  font-size: 13px;
}

.close-btn {
  background-color: transparent;
  background-image: url("../assets/icons/close-btn.svg");
  background-size: 10px;
  background-repeat: no-repeat;
  background-position: center;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  transition: background-color 0.1s;
}

.close-btn:hover {
  background-color: rgba(255, 0, 0, 0.1);
}

.window-content {
  flex: 1;
  overflow-y: auto;
  font-family: var(--font-content);
  padding: 20px;
  user-select: text;
}

.window-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* -------------------------------------- */
/* Light OS-Themed CV Layout              */
/* -------------------------------------- */
.cv-container {
  /* Fluid dimensions: clamp(min-size, ideal-size, max-size) */
  width: clamp(850px, 60vw, 1200px);
  height: clamp(600px, 75vh, 900px);

  /* Safety fallback: prevents the explicit size from clipping on small screens */
  max-width: calc(90vw - 40px);
  max-height: calc(85vh - 76px);

  display: flex;
  background-color: var(--window-bg);
  color: var(--text-main);
  margin: -20px;
  border-radius: 0 0 var(--radius-window) var(--radius-window);
  font-family: var(--font-ui);
  overflow: hidden;
}

/* -------------------------------------- */
/* Sidebar / Profile Area                 */
/* -------------------------------------- */
.cv-sidebar {
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 40px 30px;
  background-color: rgba(0, 0, 0, 0.03);
  border-right: 1px solid var(--border-light);
  overflow-y: auto;
  height: 100%;
}

.cv-photo {
  width: 80%;
  aspect-ratio: 1 / 1;
  border-radius: 50px;
  object-fit: cover;
  object-position: center top;
  margin: 0 auto;
  display: block;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  background-color: #ffffff;
}

.cv-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: -10px;
  white-space: nowrap;
}

/* Contact List */
.cv-contact {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.contact-item img {
  width: 14px;
  height: 14px;
  opacity: 0.8;
}

.cv-sidebar-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-color);
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 6px;
}

/* Visuals for Nationality (Pills) */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  background-color: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  color: var(--text-main);
}

/* Visuals for Languages (Key-Value List) */
.lang-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lang-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.lang-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
}

.lang-level {
  font-size: 12px;
  font-style: italic;
  color: var(--accent-color);
}

/* -------------------------------------- */
/* Main Content / Tab Nav & Timelines     */
/* -------------------------------------- */
.cv-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 40px 40px 40px; /* Top, Right, Bottom, Left */
  overflow-y: auto;
  height: 100%;
}

/* Tab Navigation System */
.cv-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 30px;
  flex-shrink: 0;
}

.cv-tab {
  background: none;
  border: none;
  padding: 8px 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition:
    color 0.1s ease,
    border-color 0.1s ease;
}

.cv-tab:hover {
  color: var(--text-main);
}

.cv-tab.active {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
}

/* Tab Content Logic */
.cv-tab-content {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.cv-tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Timeline Layout */
.timeline-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.title-icon {
  width: 24px;
  height: 24px;
}

.timeline {
  border-left: 1px solid var(--border-light);
  padding-left: 30px;
  margin-left: 10px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.timeline-item {
  position: relative;
}

.timeline-dot {
  position: absolute;
  left: -35.5px;
  top: 6px;
  width: 10px;
  height: 10px;
  background-color: var(--accent-color);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0, 102, 204, 0.3);
}

.timeline-content h4.inst {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.timeline-content .date {
  display: block;
  font-size: 13px;
  color: var(--accent-color);
  margin-bottom: 10px;
}

.timeline-content .cert-date {
  display: block;
  font-size: 13px;
  color: var(--accent-color);
  margin-bottom: 4px;
}

.timeline-content h5.degree {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 4px;
}

.timeline-content h5.role {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 12px;
}

.timeline-content h5.venue {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 12px;
}

.timeline-content h5.issuer {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 12px;
}

.timeline-content .rank {
  display: block;
  font-size: 13px;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.timeline-bullets {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

.timeline-bullets li {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-main);
  position: relative;
  padding-left: 16px;
  margin-bottom: 8px;
}

.timeline-bullets li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent-color);
}

/* -------------------------------------- */
/* Mobile Responsiveness                  */
/* -------------------------------------- */
@media (max-width: 768px) {
  /* Allow the window to scale down smaller than 400px */
  .os-window {
    min-width: 80vw;
  }

  .cv-container {
    flex-direction: column;
    overflow-y: auto;
  }

  .cv-sidebar {
    flex: none;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    padding: 30px 20px;
    overflow-y: visible;
    box-sizing: border-box; /* Ensures padding doesn't inflate width */
  }

  .cv-main {
    height: auto;
    padding: 20px;
    overflow-y: visible;
    box-sizing: border-box;
  }

  /* Stack Navigation Tabs Vertically */
  .cv-tabs {
    flex-direction: column;
    gap: 4px;
    border-bottom: none;
    margin-bottom: 24px;
  }

  .cv-tab {
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    border-bottom: none;
    border-left: 3px solid transparent; /* Move indicator to left edge */
    margin-bottom: 0;
    background-color: rgba(0, 0, 0, 0.02); /* Make tap area slightly visible */
    border-radius: 0 4px 4px 0;
  }

  /* Vertical active state */
  .cv-tab.active {
    border-bottom-color: transparent; /* Reset from base styles */
    border-left-color: var(
      --accent-color
    ); /* Highlight active tab on the left */
    background-color: rgba(0, 0, 0, 0.05);
  }

  .cv-photo {
    width: 50%;
  }
}
