/* Styling for the CV form and preview layout */
.cv-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding-top: 2rem;
}

@media (min-width: 900px) {
  .cv-container {
    flex-direction: row;
  }
  .cv-form-section {
    flex: 1;
    max-width: 50%;
    /* Ensure form doesn't take up entire screen height if very long */
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding-right: 1rem;
  }
  .cv-preview-section {
    flex: 1;
    position: sticky;
    top: 2rem;
    height: max-content;
    display: flex;
    justify-content: center;
    /* hide overflow so scaling doesn't cause page scroll */
    overflow: hidden;
  }
}

.form-group {
  margin-bottom: 1.5rem;
}
.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
}
.form-group input, .form-group textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: inherit;
}
.form-group textarea {
  min-height: 100px;
}

.dynamic-list {
  border: 1px solid #eee;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  background: white;
}
.dynamic-item {
  position: relative;
  padding: 1.5rem 1rem 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 1rem;
  background: #fafafa;
}
.remove-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: #ff4d4f;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 0.8rem;
}
.add-btn {
  background: #0056b3;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
  font-weight: bold;
}

.download-btn {
  display: block;
  width: 100%;
  background: #28a745;
  color: white;
  border: none;
  padding: 1rem;
  font-size: 1.1rem;
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 1rem;
  text-align: center;
  position: sticky;
  bottom: 1rem;
}

/* CV Preview Container - Scales on screen */
.cv-preview-wrapper {
  /* Set a max width to the preview container and scale the contents to fit */
  width: 100%;
  max-width: 800px;
  /* Maintain A4 aspect ratio 1:1.414 */
  background: #e0e0e0;
  display: flex;
  justify-content: center;
}

.cv-preview {
  background: white;
  /* Actual A4 dimensions */
  width: 794px; /* A4 width at 96 DPI */
  min-height: 1123px; /* A4 height at 96 DPI */
  padding: 40px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  box-sizing: border-box;

  /* Apply scaling based on viewport */
  transform-origin: top left;
  transform: scale(0.6);
  margin-bottom: -45%; /* Compensate for scaling to avoid empty space */
}

@media (min-width: 900px) {
  .cv-preview {
    transform: scale(0.65);
    margin-bottom: -35%;
  }
}

@media (min-width: 1200px) {
  .cv-preview {
    transform: scale(0.8);
    margin-bottom: -20%;
  }
}

@media (max-width: 600px) {
  .cv-preview {
    transform: scale(0.45);
    margin-bottom: -60%;
  }
}


/* Actual CV Styling - Munich Template */
.cv-template {
  font-family: Arial, Helvetica, sans-serif;
  color: #333;
  line-height: 1.5;
  font-size: 11px;
}

.cv-template p {
  margin: 0 0 8px 0;
}

/* Page Break Handling */
.cv-template .section,
.cv-template .exp-item,
.cv-template .edu-item,
.cv-template .skill-item {
  page-break-inside: avoid;
  break-inside: avoid;
}

/* Header */
.cv-header {
  border-bottom: 1px solid #ddd;
  padding-bottom: 20px;
  margin-bottom: 20px;
}

.cv-prof-title {
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #555;
  margin-bottom: 5px;
}

.cv-name {
  font-family: "Georgia", serif;
  font-size: 36px;
  font-weight: normal;
  text-transform: uppercase;
  margin: 0;
  line-height: 1.1;
  letter-spacing: 2px;
  color: #333;
}

/* Body Two Column */
.cv-body {
  display: flex;
}

.cv-left {
  width: 33%;
  padding-right: 20px;
}

.cv-right {
  width: 67%;
  padding-left: 20px;
  border-left: 1px solid #ddd;
}

/* Sections */
.cv-section-title {
  font-size: 13px;
  font-weight: normal;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 15px;
  margin-top: 0;
  color: #333;
}

.cv-left .cv-section {
  margin-bottom: 30px;
}

.cv-right .cv-section {
  margin-bottom: 30px;
}

/* Contact Details */
.cv-contact-item {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  color: #555;
  word-break: break-all;
}
.cv-contact-icon {
  margin-right: 10px;
  width: 14px;
  opacity: 0.6;
}

/* Lists (Skills/Languages) */
.cv-list-item {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  color: #555;
}
.cv-list-item::before {
  content: "■";
  font-size: 8px;
  color: #999;
  margin-right: 8px;
}
.cv-level {
  color: #777;
  font-style: italic;
  font-size: 10px;
}

/* Experience/Education Items */
.cv-item {
  margin-bottom: 20px;
}
.cv-item-title {
  font-weight: bold;
  font-size: 11px;
  text-transform: uppercase;
  margin-bottom: 4px;
  letter-spacing: 1px;
}
.cv-item-meta {
  font-size: 11px;
  color: #555;
  margin-bottom: 8px;
}
.cv-item-company {
  font-weight: bold;
  color: #333;
}
.cv-item-desc {
  color: #555;
}
.cv-item-desc ul {
  padding-left: 16px;
  margin-top: 4px;
  margin-bottom: 0;
}
.cv-item-desc li {
  margin-bottom: 4px;
  color: #777;
}
