/*==============================================================================
  CSS VARIABLES
==============================================================================*/
/* Color scheme for different sections */
:root {
  --infos-color: #9b59b6;
  --icon-color: #29aaff;
  --contenus-color: #73b7e4;
  --experience-color: #268fa8;
  --succes-color: #f47f52;
  --portage-color: #fec533;
  --attestation-color: #27ae60;
  --background: #f8f9fa;
  --footer-background: #e9ecef;
  --white: #ffffff;
  --text-dark: #2c3e50;
  --text-light: #6c757d;
  --border: #dee2e6;
  --shadow: rgba(0, 0, 0, 0.1);
}

/*==============================================================================
  RESET & BASE STYLES
==============================================================================*/
/* Global reset for consistent styling */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Base body styling */
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--background);
  color: var(--text-dark);
  line-height: 1.6;
}

/* Main container wrapper */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/*==============================================================================
  LINK STYLES
==============================================================================*/
/* Styled links for dynamic URLs in text content */
a:not(.feedback-link) {
  color: #007bff;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:not(.feedback-link):hover {
  color: #0056b3;
  text-decoration: underline;
}

a:not(.feedback-link):focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
  border-radius: 2px;
}

/* Links in text content */
.intro-content a:not(.feedback-link),
.section-description a:not(.feedback-link) {
  color: #0066cc;
  font-weight: 500;
}

.intro-content a:not(.feedback-link):hover,
.section-description a:not(.feedback-link):hover {
  color: #004499;
}

/*==============================================================================
  HEADER SECTION
==============================================================================*/
/* Main header container */
header {
  margin-bottom: 40px;
  padding: 30px;
  background: var(--white);
  border-radius: 15px;
  box-shadow: 0 4px 15px var(--shadow);
}

/* Header content layout */
.header-content {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Logo styling */
.logo {
  height: 60px;
  width: auto;
  flex-shrink: 0;
}

/* Ghost div to balance the logo and center the text */
.logo-ghost {
  height: 60px;
  width: 160px;
  flex-shrink: 0;
  visibility: hidden;
}

/* Header text container */
.header-text {
  flex: 1;
  text-align: center;
}

/* Title container for h1 and beta tag */
.title-container {
  position: relative;
  margin-bottom: 10px;
  display: inline-block;
}

/* Main heading with gradient effect */
.header-text h1 {
  font-size: 2.5rem;
  margin-bottom: 0;
  display: inline-block;
  background: linear-gradient(
    45deg,
    var(--contenus-color),
    var(--experience-color)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Beta tag styling */
.beta-tag {
  position: absolute;
  top: 0;
  left: calc(100% + 10px);
  background: #ff6b6b;
  color: white;
  font-size: 0.7rem;
  font-weight: bold;
  padding: 3px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Hidden class for elements that should be hidden by default */
.hidden {
  display: none !important;
}

/* Header description text */
header p {
  color: var(--text-light);
  font-size: 1.1rem;
}

/*==============================================================================
  SECTIONS LAYOUT
==============================================================================*/
/* Base section styling */
.section {
  background: var(--white);
  border-radius: 15px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 4px 15px var(--shadow);
  border-left: 5px solid var(--contenus-color);
}

/* Section color variants based on type */
.section.infos {
  border-left-color: var(--infos-color);
}

.section.icon-section {
  border-left-color: var(--icon-color);
}

.section.contenus {
  border-left-color: var(--contenus-color);
}

.section.experience {
  border-left-color: var(--experience-color);
}

.section.succes {
  border-left-color: var(--succes-color);
}

.section.portage {
  border-left-color: var(--portage-color);
}

.section.attestation {
  border-left-color: var(--attestation-color);
}

/* Section headings */
.section h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Section descriptions */
.section-description {
  margin-bottom: 20px;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 8px;
  border-left: 3px solid #e3e3e3;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-dark);
}

.section-description p {
  margin-bottom: 12px;
}

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

/* Introduction text styling */
.intro-text {
  border-left-color: #0099ff;
  font-size: 0.8rem;
}

.intro-content {
  /* background-color: #e7f3ff; */
  border-left-color: #e3e3e3;
}

/* Feedback section styling */
.section.feedback {
  border-left-color: #00a6ff;
  margin-top: 80px;
  margin-bottom: -60px;
  font-style: italic;
}

.feedback-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(90deg, #29aaff 0%, #73b7e4 100%);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  padding: 12px 28px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(41, 170, 255, 0.12);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  position: relative;
  margin-top: 10px;
}

.feedback-link:hover,
.feedback-link:focus {
  background: linear-gradient(90deg, #268fa8 0%, #29aaff 100%) !important;
  color: #fff !important;
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 4px 16px rgba(41, 170, 255, 0.18);
  text-decoration: none !important;
  outline: none;
}

.feedback-link:active {
  transform: scale(0.98);
  box-shadow: 0 1px 4px rgba(41, 170, 255, 0.10);
}

/* Beta tag styling */
.beta-tag {
  display: inline-block;
  background-color: #ff6b6b;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: bold;
  vertical-align: middle;
  margin-left: -5px;
}

.beta-tag.hidden {
  display: none;
}

/*==============================================================================
  USER INFORMATION SECTION
==============================================================================*/
/* User info grid layout */
.user-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

/* Text input fields */
.input-group input[type="text"],
.input-group input[type="email"] {
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

/* Text input focus state */
.input-group input[type="text"]:focus,
.input-group input[type="email"]:focus {
  outline: none;
  border-color: var(--infos-color);
}

/* Checkbox group styling */
.checkbox-group {
  grid-column: 1 / -1;
  margin-top: 10px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-dark);
}

.checkbox-label input[type="checkbox"] {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  accent-color: var(--infos-color);
}

.checkbox-text {
  line-height: 1.4;
}

/* Anonymous mode indicator */
.infos.anonymous-mode {
  position: relative;
}

.infos.anonymous-mode::after {
  content: "🔒 Mode anonyme activé - Ces informations ne seront pas communiquées";
  display: block;
  background: rgba(155, 89, 182, 0.1);
  color: var(--infos-color);
  padding: 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 15px;
  text-align: center;
}

/* Hidden state for icon section when anonymous */
.icon-section.hidden-anonymous {
  display: none;
}

/*==============================================================================
  FORM INPUTS & ICON UPLOAD
==============================================================================*/
/* Icon input container */
.icon-input {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Input group wrapper */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Input labels */
.input-group label {
  font-weight: 600;
  color: var(--text-dark);
}

/* URL input fields */
.input-group input[type="url"] {
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

/* URL input focus state */
.input-group input[type="url"]:focus {
  outline: none;
  border-color: var(--contenus-color);
}

/* File upload input */
.input-group input[type="file"] {
  padding: 8px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

/* File input hover state */
.input-group input[type="file"]:hover {
  border-color: var(--contenus-color);
}

/* OR divider between input options */
.or-divider {
  text-align: center;
  position: relative;
  margin: 10px 0;
}

/* OR divider line */
.or-divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}

/* OR divider text */
.or-divider span {
  background: var(--white);
  padding: 0 15px;
  color: var(--text-light);
  font-weight: 600;
}

/*==============================================================================
  CRITERIA GRID & SLIDERS
==============================================================================*/
/* Grid layout for criteria items */
.criteria-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

/* Individual criteria item */
.criteria-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* Criteria item labels */
.criteria-item label {
  font-weight: 600;
  color: var(--text-dark);
  font-size: 0.95rem;
}

/* Custom range slider styling */
.criteria-item input[type="range"] {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

/* Webkit slider thumb styling */
.criteria-item input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--contenus-color);
  cursor: pointer;
  transition: all 0.2s ease;
}

/* Webkit slider thumb hover effect */
.criteria-item input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Firefox slider thumb styling */
.criteria-item input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--contenus-color);
  cursor: pointer;
  border: none;
}

/* Section-specific slider thumb colors */
.contenus .criteria-item input[type="range"]::-webkit-slider-thumb {
  background: var(--contenus-color);
}

.experience .criteria-item input[type="range"]::-webkit-slider-thumb {
  background: var(--experience-color);
}

.succes .criteria-item input[type="range"]::-webkit-slider-thumb {
  background: var(--succes-color);
}

.portage .criteria-item input[type="range"]::-webkit-slider-thumb {
  background: var(--portage-color);
}

/* Value display for sliders */
.value-display {
  text-align: center;
  font-weight: bold;
  font-size: 1.2rem;
  color: var(--text-dark);
  padding: 5px 10px;
  background: var(--background);
  border-radius: 20px;
  min-width: 40px;
}

/*==============================================================================
  ARGUMENT TEXTAREAS
==============================================================================*/
/* Argument group container */
.argument-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

/* Argument textarea labels */
.argument-group label {
  font-weight: 500;
  color: var(--text-dark);
  font-size: 0.9rem;
}

/* Argument textareas */
.argument-group textarea {
  width: 100%;
  min-height: 80px;
  max-height: 500px;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  transition: border-color 0.2s ease;
  background: var(--white);
}

/* Textarea focus state */
.argument-group textarea:focus {
  outline: none;
  border-color: var(--contenus-color);
}

/* Disabled textarea */
.argument-group textarea:disabled {
  background: #f8f9fa;
  color: #6c757d;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Character count display */
.char-count {
  font-size: 0.8rem;
  color: var(--text-light);
  text-align: right;
  font-style: italic;
}

/* Section-specific textarea focus colors */
.contenus .argument-group textarea:focus {
  border-color: var(--contenus-color);
}

.experience .argument-group textarea:focus {
  border-color: var(--experience-color);
}

.succes .argument-group textarea:focus {
  border-color: var(--succes-color);
}

.portage .argument-group textarea:focus {
  border-color: var(--portage-color);
}

/* Required argument group styling */
.argument-group.required label {
  color: var(--text-dark);
  font-weight: 600;
}

.argument-group.required textarea {
  border-color: #3498db;
  border-width: 2px;
}

.argument-group.required textarea:focus {
  border-color: #2980b9;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.argument-group.required textarea::placeholder {
  color: #7f8c8d;
  font-style: italic;
}

/* Validation error state */
.argument-group.error textarea {
  border-color: #e74c3c !important;
  background-color: #fdf2f2;
}

.argument-group.error .char-count {
  color: #e74c3c !important;
}

/*==============================================================================
  BUTTONS & ACTIONS
==============================================================================*/
/* Actions container */
.actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 30px;
}

/* Base button styling */
button {
  padding: 15px 30px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Test button styling */
#testBtn {
  background: var(--experience-color);
  color: var(--white);
}

#testBtn:hover {
  background: #1f7a92;
  transform: translateY(-2px);
}

/* Reset button styling */
#resetBtn {
  background: var(--text-light);
  color: var(--white);
}

#resetBtn:hover {
  background: #5a6268;
  transform: translateY(-2px);
}

/* Generate button styling */
#generateBtn {
  background: linear-gradient(
    45deg,
    var(--contenus-color),
    var(--experience-color)
  );
  color: var(--white);
  font-size: 1.1rem;
}

#generateBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(115, 183, 228, 0.3);
}

/* Disabled generate button */
#generateBtn:disabled {
  background: var(--text-light);
  cursor: not-allowed;
  transform: none;
}

/*==============================================================================
  RESULT DISPLAY
==============================================================================*/
/* Result container */
.result {
  background: var(--white);
  border-radius: 15px;
  padding: 30px;
  margin-top: 30px;
  box-shadow: 0 4px 15px var(--shadow);
  text-align: center;
}

/* Result heading */
.result h2 {
  margin-bottom: 20px;
  font-size: 2em;
  color: var(--text-dark);
}

/* Generated image styling */
#resultImage img,
#resultScoreImage img,
#resultTableImage img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 4px 15px var(--shadow);
}

/* PDF iframe styling for table */
#resultTableImage iframe {
  max-width: 100%;
  min-height: 600px;
  border-radius: 10px;
  box-shadow: 0 4px 15px var(--shadow);
}

/* Result images container */
.result-images {
  display: flex;
  flex-direction: column;
  gap: 30px;
  margin-bottom: 20px;
}

/* Individual result section */
.result-section {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 20px;
}

.result-section h3 {
  margin-bottom: 15px;
  color: var(--text-dark);
  font-size: 1.3em;
}

/* Result action buttons container */
.result-actions {
  margin-top: 20px;
  display: flex;
  gap: 15px;
  justify-content: center;
}

/* Download button styling */
#downloadBtn,
#downloadPreviewBtn,
#downloadFinalBtn,
#downloadPreviewScoreBtn,
#downloadPreviewTableBtn,
#downloadFinalScoreBtn,
#downloadFinalTableBtn {
  background: var(--succes-color);
  color: var(--white);
}

#downloadBtn:hover,
#downloadPreviewBtn:hover,
#downloadFinalBtn:hover,
#downloadPreviewScoreBtn:hover,
#downloadPreviewTableBtn:hover,
#downloadFinalScoreBtn:hover,
#downloadFinalTableBtn:hover {
  background: #e56b3f;
  transform: translateY(-2px);
}

/* New fresque button styling */
#newFresqueBtn {
  background: var(--portage-color);
  color: var(--text-dark);
}

#newFresqueBtn:hover {
  background: #e5b12f;
  transform: translateY(-2px);
}

/* Generate final button styling */
#generateFinalBtn {
  background: linear-gradient(135deg, #8b5cf6, #a855f7);
  color: white;
  position: relative;
  overflow: hidden;
}

#generateFinalBtn:hover {
  background: linear-gradient(135deg, #7c3aed, #9333ea);
  transform: translateY(-2px);
}

#generateFinalBtn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

#generateFinalBtn:hover::before {
  left: 100%;
}

/*==============================================================================
  LOADING STATE
==============================================================================*/
/* Loading container */
.loading {
  background: var(--white);
  border-radius: 15px;
  padding: 40px;
  margin-top: 30px;
  box-shadow: 0 4px 15px var(--shadow);
  text-align: center;
}

/* Loading spinner animation */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top: 4px solid var(--contenus-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

/* Spinner rotation keyframes */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/*==============================================================================
  RESULT LOADING STATE
==============================================================================*/
/* Loading in result area */
.result-loading {
  text-align: center;
  padding: 40px;
  color: var(--text-medium);
}

.result-loading .spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 20px;
}

.result-loading p {
  font-size: 16px;
  color: var(--text-medium);
}

/*==============================================================================
  ERROR STATE
==============================================================================*/
/* Error container */
.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  border-radius: 15px;
  padding: 20px;
  margin-top: 30px;
  text-align: center;
}

/* Error heading */
.error h3 {
  margin-bottom: 10px;
}

/* Error button styling */
.error button {
  background: #dc3545;
  color: var(--white);
  margin-top: 15px;
}

.error button:hover {
  background: #c82333;
}

/*==============================================================================
  UTILITY CLASSES
==============================================================================*/
/* Hide elements */
.hidden {
  display: none !important;
}

/*==============================================================================
  ATTESTATION SECTION
==============================================================================*/
/* Attestation content container */
.attestation-content {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: rgba(39, 174, 96, 0.05);
  border-radius: 10px;
  border: 2px solid rgba(39, 174, 96, 0.2);
}

/* Attestation checkbox specific styling */
.attestation-checkbox {
  margin: 0;
  grid-column: unset;
}

.attestation-checkbox .checkbox-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--attestation-color);
  justify-content: center;
  text-align: center;
}

.attestation-checkbox .checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--attestation-color);
  margin-top: 0;
}

.attestation-checkbox .checkbox-text {
  margin-left: 5px;
}

/* Attestation section required field indicator */
.attestation-checkbox .checkbox-text::after {
  content: " *";
  color: #e74c3c;
  font-weight: bold;
}

/*==============================================================================
  RESPONSIVE DESIGN
==============================================================================*/
/* Mobile and tablet breakpoint */
@media (max-width: 768px) {
  /* Container adjustments */
  .container {
    padding: 15px;
  }

  /* Header responsive layout */
  .header-content {
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }

  /* Hide ghost div on mobile */
  .logo-ghost {
    display: none;
  }

  /* Smaller logo on mobile */
  .logo {
    height: 50px;
  }

  /* Smaller heading on mobile */
  .header-text h1 {
    font-size: 2rem;
  }

  /* Single column user info grid */
  .user-info-grid {
    grid-template-columns: 1fr;
  }

  /* Single column criteria grid */
  .criteria-grid {
    grid-template-columns: 1fr;
  }

  /* Vertical action buttons layout */
  .actions {
    flex-direction: column;
    align-items: center;
  }

  /* Vertical result actions layout */
  .result-actions {
    flex-direction: column;
    align-items: center;
  }

  /* Stack result images vertically on mobile */
  .result-images {
    gap: 20px;
  }

  .result-section {
    padding: 15px;
  }

  /* Reduced spacing for icon inputs */
  .icon-input {
    gap: 10px;
  }
}

/*==============================================================================
  TOOLTIPS
==============================================================================*/
/* Temporary tooltip for value changes */
.value-tooltip {
  position: fixed;
  background: rgba(44, 62, 80, 0.95);
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
  max-width: 350px;
  min-width: 200px;
  z-index: 10000;
  opacity: 0;
  transform: translateY(10px) scale(0.9);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(10px);
  white-space: normal;
  word-wrap: break-word;
  text-align: center;
}

.value-tooltip.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.value-tooltip::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(44, 62, 80, 0.95);
}

/* Remove tooltip-trigger styles for value displays */
.value-display {
  cursor: default;
}

/*==============================================================================
  GLOBAL FOOTER
==============================================================================*/
/* Global footer container */
.global-footer {
  background: var(--footer-background);
  color: var(--text-dark);
  margin-top: 60px;
  padding: 20px 0;
  text-align: center;
}

/* Footer content wrapper */
.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Footer text styling */
.global-footer p {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.9;
  letter-spacing: 0.5px;
}

/* Responsive footer */
@media (max-width: 768px) {
  .global-footer {
    margin-top: 40px;
    padding: 15px 0;
  }

  .global-footer p {
    font-size: 0.8rem;
  }
}
