/**
 * CV Preview with Diff Highlighting
 * Mobile-first responsive design, WCAG 2.1 AA compliant
 */

/* Main Container */
.cv-preview-diff {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Mode Switcher */
.preview-mode-switcher {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding: 0.5rem;
  background: #f6f7f8;
  border-radius: 0.5rem;
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: white;
  border: 2px solid transparent;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1 1 auto;
  min-width: 120px;
  justify-content: center;
}

.mode-btn:hover {
  background: #f1f5f9;
  color: #334155;
}

.mode-btn:focus {
  outline: 2px solid #137fec;
  outline-offset: 2px;
}

.mode-btn.active {
  background: #137fec;
  border-color: #137fec;
  color: white;
}

.mode-btn .material-symbols-outlined {
  font-size: 1.25rem;
}

/* Preview Content */
.preview-content {
  position: relative;
  display: grid;
  gap: 1.5rem;
  min-height: 400px;
}

/* Side-by-side mode */
.preview-content.side-by-side {
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .preview-content.side-by-side {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
}

/* Before only */
.preview-content.before .preview-after {
  display: none;
}

/* After only */
.preview-content.after .preview-before {
  display: none;
}

/* Diff mode (show both with heavy highlighting) */
.preview-content.diff {
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .preview-content.diff {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
}

/* Preview Panels */
.preview-before,
.preview-after {
  padding: 1.5rem;
  background: #f9fafb;
  border-radius: 0.5rem;
  overflow-y: auto;
  max-height: 600px;
}

.preview-before::before {
  content: 'ANTES';
  display: block;
  margin-bottom: 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.05em;
}

.preview-after::before {
  content: 'DEPOIS';
  display: block;
  margin-bottom: 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #10b981;
  letter-spacing: 0.05em;
}

/* CV Content */
.cv-content {
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.6;
  color: #1e293b;
}

.cv-section {
  margin-bottom: 2rem;
}

.cv-section:last-child {
  margin-bottom: 0;
}

.cv-section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e2e8f0;
}

.cv-section-content {
  font-size: 0.9375rem;
}

/* Personal Info */
.personal-info {
  text-align: center;
  margin-bottom: 1rem;
}

.cv-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.5rem;
}

.cv-contact {
  font-size: 0.875rem;
  color: #64748b;
  margin: 0.25rem 0;
}

/* Summary */
.summary-content {
  padding: 1rem;
  background: white;
  border-left: 3px solid #137fec;
  border-radius: 0.25rem;
  line-height: 1.7;
}

/* Experience */
.experience-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.experience-item {
  padding: 1rem;
  background: white;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
}

.exp-header {
  margin-bottom: 0.75rem;
}

.exp-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 0.25rem;
}

.exp-company {
  font-size: 1rem;
  color: #475569;
  margin-bottom: 0.25rem;
}

.exp-period {
  font-size: 0.875rem;
  color: #94a3b8;
}

.exp-description {
  margin: 0.75rem 0;
  line-height: 1.6;
}

.exp-achievements {
  margin: 0.75rem 0 0 1.5rem;
  padding: 0;
  list-style: disc;
}

.exp-achievements li {
  margin: 0.5rem 0;
  line-height: 1.6;
}

/* Education */
.education-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.education-item {
  padding: 1rem;
  background: white;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
}

.edu-degree {
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 0.25rem;
}

.edu-institution {
  font-size: 0.9375rem;
  color: #475569;
  margin-bottom: 0.25rem;
}

.edu-period {
  font-size: 0.875rem;
  color: #94a3b8;
}

/* Skills */
.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill-badge {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
}

.skill-badge:hover {
  background: #bae6fd;
}

/* Diff Highlighting */

/* Additions (green) */
.diff-addition {
  background: #d1fae5;
  color: #065f46;
  padding: 0.125rem 0.25rem;
  border-radius: 0.125rem;
  border-left: 3px solid #10b981;
  animation: highlight-pulse 0.5s ease-out;
}

/* Modifications (yellow) */
.diff-modification {
  background: #fef3c7;
  color: #92400e;
  padding: 0.125rem 0.25rem;
  border-radius: 0.125rem;
  border-left: 3px solid #f59e0b;
  animation: highlight-pulse 0.5s ease-out;
}

/* Deletions (red) - only in "before" panel */
.diff-deletion {
  background: #fee2e2;
  color: #991b1b;
  padding: 0.125rem 0.25rem;
  border-radius: 0.125rem;
  text-decoration: line-through;
  border-left: 3px solid #ef4444;
  opacity: 0.7;
}

/* Before/After markers */
.diff-before {
  opacity: 0.8;
}

.diff-after {
  /* Already styled with diff classes */
}

/* Highlight animation */
@keyframes highlight-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Scrollbar styling (optional, for better UX) */
.preview-before::-webkit-scrollbar,
.preview-after::-webkit-scrollbar {
  width: 8px;
}

.preview-before::-webkit-scrollbar-track,
.preview-after::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.preview-before::-webkit-scrollbar-thumb,
.preview-after::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.preview-before::-webkit-scrollbar-thumb:hover,
.preview-after::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Responsive adjustments */
@media (max-width: 767px) {
  .cv-preview-diff {
    padding: 0.75rem;
  }

  .mode-btn {
    font-size: 0.8125rem;
    padding: 0.625rem 0.75rem;
    min-width: 100px;
  }

  .mode-btn span {
    display: none;
  }

  .mode-btn .material-symbols-outlined {
    margin: 0;
  }

  .preview-before,
  .preview-after {
    padding: 1rem;
    max-height: 500px;
  }

  .cv-section-title {
    font-size: 1.125rem;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .cv-preview-diff {
    background: #1e293b;
  }

  .preview-mode-switcher {
    background: #0f172a;
  }

  .mode-btn {
    background: #1e293b;
    color: #cbd5e1;
  }

  .mode-btn:hover {
    background: #334155;
    color: #f1f5f9;
  }

  .preview-before,
  .preview-after {
    background: #0f172a;
  }

  .cv-content {
    color: #e2e8f0;
  }

  .cv-section-title {
    color: #f1f5f9;
    border-bottom-color: #334155;
  }

  .summary-content,
  .experience-item,
  .education-item {
    background: #1e293b;
    border-color: #334155;
  }
}
