/* ===== Variables CSS ===== */
:root {
  --primary-color: #1e40af;
  --primary-dark: #1a368f;
  --primary-light: #3b61d7;
  --bg-color: #ffffff;
  --text-color: #333333;
  --text-light: #666666;
  --secondary-color: #f8f9fa;
  --accent-color: var(--primary-color);
  --border-color: #e0e0e0;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --section-bg: #ffffff;
  --card-bg: #ffffff;
}

.dark {
  --bg-color: #121212;
  --text-color: #f0f0f0;
  --text-light: #cccccc;
  --secondary-color: #1e1e1e;
  --border-color: #333333;
  --shadow-color: rgba(0, 0, 0, 0.3);
  --section-bg: #1e1e1e;
  --card-bg: #2a2a2a;
}

/* ===== Reset et Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.7;
  color: var(--text-color);
  background-color: var(--bg-color);
  margin: 0;
  padding: 0;
  transition: background-color 0.3s, color 0.3s;
}

/* ===== Container ===== */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
}

/* ===== En-tête ===== */
.cv-header {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  padding: 2.5rem;
  margin-bottom: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 20px var(--shadow-color);
  position: relative;
  overflow: hidden;
}

.cv-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  animation: rotate 20s linear infinite;
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.theme-toggle-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  z-index: 10;
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.header-content {
  display: flex;
  align-items: center;
  gap: 2rem;
  position: relative;
  z-index: 1;
}

.photo-container {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid white;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.profile-pic {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.profile-pic:hover {
  transform: scale(1.05);
}

.profile-placeholder {
  width: 100%;
  height: 100%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: white;
}

.header-text {
  flex: 1;
}

.cv-name {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.cv-job-title {
  font-size: 1.3rem;
  font-weight: 500;
  margin-bottom: 1rem;
  opacity: 0.95;
}

.cv-summary {
  font-size: 1.1rem;
  font-style: italic;
  margin-bottom: 1.5rem;
  opacity: 0.9;
  line-height: 1.8;
}

.contact-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.95rem;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.contact-item i {
  color: var(--primary-light);
}

/* ===== Liens cliquables ===== */
.contact-link {
  color: var(--text-color);
  text-decoration: none;
  transition: all 0.2s ease;
  border-bottom: 1px solid transparent;
}

.contact-link:hover {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.contact-item-full a.contact-link {
  color: var(--text-color);
}

.contact-item-full a.contact-link:hover {
  color: var(--primary-color);
}

/* ===== Sections ===== */
.cv-section {
  margin-bottom: 2rem;
  background-color: var(--section-bg);
  border-radius: 12px;
  box-shadow: 0 2px 10px var(--shadow-color);
  overflow: hidden;
  transition: all 0.3s;
}

.cv-section:hover {
  box-shadow: 0 4px 20px var(--shadow-color);
}

.section-header {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-header h2 {
  font-size: 1.4rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-line {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.3);
}

.section-content {
  padding: 1.5rem;
}

/* ===== Expériences ===== */
.experience {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.experience:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.experience-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.experience-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary-color);
}

.experience-company {
  font-weight: 500;
  color: var(--text-color);
}

.experience-date {
  font-size: 0.9rem;
  color: var(--text-light);
  text-align: right;
  white-space: nowrap;
}

.experience-location {
  font-size: 0.9rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.experience-description {
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

.experience-details {
  margin-top: 0.75rem;
}

.experience-detail-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
  font-size: 0.95rem;
}

.experience-detail-list {
  list-style: none;
  padding-left: 0;
}

.experience-detail-list li {
  padding-left: 1.25rem;
  position: relative;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.experience-detail-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--primary-color);
  font-weight: bold;
}

.experience-technos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.tech-tag {
  background: var(--primary-light);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* ===== Formation ===== */
.formation-item {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.formation-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.formation-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.formation-degree {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--primary-color);
}

.formation-school {
  font-weight: 500;
}

.formation-date {
  font-size: 0.9rem;
  color: var(--text-light);
  text-align: right;
  white-space: nowrap;
}

.formation-location {
  font-size: 0.9rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.formation-description {
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

.formation-mention {
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.formation-mention span {
  margin-right: 1rem;
  color: var(--text-light);
}

.formation-courses {
  margin-top: 0.75rem;
}

.formation-courses-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.course-tag {
  background: var(--secondary-color);
  color: var(--text-color);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
}

.formation-link {
  margin-top: 0.75rem;
}

.formation-link a {
  color: var(--primary-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.formation-link a:hover {
  text-decoration: underline;
}

/* ===== Compétences ===== */
.competence-category {
  margin-bottom: 1.5rem;
}

.competence-category:last-child {
  margin-bottom: 0;
}

.competence-category-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.competence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.competence-item {
  background: var(--card-bg);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  transition: all 0.3s;
}

.competence-item:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.competence-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.competence-name {
  font-weight: 600;
  color: var(--text-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.competence-level {
  font-size: 0.8rem;
  color: var(--primary-color);
  font-weight: 500;
}

.competence-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.keyword-tag {
  background: var(--secondary-color);
  color: var(--text-light);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

/* ===== Projets ===== */
.projet {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.projet:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.projet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.projet-name {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary-color);
}

.projet-date {
  font-size: 0.9rem;
  color: var(--text-light);
}

.projet-links {
  display: flex;
  gap: 0.75rem;
}

.projet-link {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.3s;
}

.projet-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.projet-description {
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

.projet-technos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* ===== Certifications ===== */
.certification {
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--card-bg);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.certification-info {
  flex: 1;
}

.certification-name {
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 0.25rem;
}

.certification-organisme {
  font-size: 0.9rem;
  color: var(--text-light);
}

.certification-date {
  font-size: 0.9rem;
  color: var(--primary-color);
  white-space: nowrap;
  margin-left: 1rem;
}

.certification a {
  color: inherit;
  text-decoration: none;
}

/* ===== Associations ===== */
.association {
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--card-bg);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.association-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.association-name {
  font-weight: 600;
  color: var(--primary-color);
}

.association-date {
  font-size: 0.9rem;
  color: var(--text-light);
}

.association-description {
  margin-bottom: 0.5rem;
}

.association-logo {
  width: 24px;
  height: 24px;
  border-radius: 4px;
}

.association-link {
  color: var(--primary-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* ===== Langues ===== */
.langue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.langue-item {
  background: var(--card-bg);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  text-align: center;
}

.langue-name {
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 0.25rem;
}

.langue-level {
  font-size: 0.9rem;
  color: var(--primary-color);
}

/* ===== Centres d'intérêt ===== */
.interet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.interet-category {
  background: var(--card-bg);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.interet-category-title {
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.interet-elements {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.interet-element {
  background: var(--secondary-color);
  color: var(--text-color);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
}

/* ===== Contact ===== */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.contact-item-full {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--card-bg);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  transition: all 0.3s;
}

.contact-item-full:hover {
  border-color: var(--primary-color);
}

.contact-item-full i {
  font-size: 1.2rem;
  color: var(--primary-color);
  min-width: 24px;
  text-align: center;
}

.contact-item-full span {
  font-size: 0.95rem;
}

.contact-item-full a {
  color: var(--text-color);
  text-decoration: none;
}

.contact-item-full a:hover {
  color: var(--primary-color);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  .header-content {
    flex-direction: column;
    text-align: center;
  }

  .photo-container {
    width: 120px;
    height: 120px;
    margin-bottom: 1rem;
  }

  .cv-name {
    font-size: 2rem;
  }

  .cv-job-title {
    font-size: 1.1rem;
  }

  .cv-summary {
    font-size: 1rem;
  }

  .contact-preview {
    justify-content: center;
  }

  .experience-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .experience-date {
    text-align: left;
  }

  .formation-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .formation-date {
    text-align: left;
  }

  .projet-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .competence-grid {
    grid-template-columns: 1fr;
  }

  .langue-grid {
    grid-template-columns: 1fr;
  }

  .interet-grid {
    grid-template-columns: 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Impression ===== */
@media print {
  body {
    padding: 0;
    background-color: white !important;
    color: black !important;
  }

  .dark {
    --bg-color: white;
    --text-color: black;
    --text-light: #666666;
    --secondary-color: #f0f0f0;
    --border-color: #cccccc;
    --section-bg: white;
    --card-bg: #f8f9fa;
  }

  #theme-toggle {
    display: none !important;
  }

  .cv-header {
    background: #1e40af !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .section-header {
    background: #1e40af !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .contact-item-full a::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  .cv-section {
    break-inside: avoid;
    box-shadow: none;
  }

  .experience, .formation-item, .projet {
    break-inside: avoid;
  }
}
