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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Écrans */
.screen {
    width: 100%;
    max-width: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: slideIn 0.5s ease-out;
}

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

/* Écran de chargement supprimé */

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

/* Formulaire */
.form-container {
    padding: 20px 40px 40px;
}

.header {
    text-align: center;
    margin-bottom: 40px;
}

.header .form-logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin-bottom: 10px;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1rem;
    color: #718096;
    line-height: 1.6;
}

.participant-form {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

@media screen and (max-width: 768px) {
    .form-container {
        padding: 10px 20px 20px;
    }
    .header {
        margin-bottom: 30px;
    }
    .header .form-logo {
        width: 64px;
        height: 64px;
    }
    .header h1 {
        font-size: 1.5rem;
    }
    .header p {
        font-size: 0.85rem;
    }
    .participant-form {
        gap: 15px;
    }
}


.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.95rem;
}

.form-group input,
.form-group select {
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

/* Décalage permanent du texte pour laisser la place à l'icône/spinner */
#company_name {
    padding-left: 36px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input.error,
.form-group select.error {
    border-color: #e53e3e;
}

/* Autocomplétion */
.autocomplete-container {
    position: relative;
}
/* Spinner dans le champ de recherche d'entreprise */
.company-search-spinner {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(113, 128, 150, 0.25);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: companySearchSpin 0.8s linear infinite;
    pointer-events: none;
}

@keyframes companySearchSpin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* Icône de recherche (Tabler Icons) dans l'input */
#company-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
    font-size: 18px;
    pointer-events: none;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f7fafc;
    transition: background-color 0.2s ease;
}

.suggestion-item:hover {
    background-color: #f7fafc;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-name {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 2px;
}

.suggestion-details {
    font-size: 0.85rem;
    color: #718096;
}

/* Spinner spécifique à la recherche pour éviter tout conflit avec la roue */
/* Ancien spinner de suggestion supprimé */

/* Radio buttons */
.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 5px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #4a5568;
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-radius: 50%;
    position: relative;
    transition: all 0.3s ease;
}

.radio-label input[type="radio"]:checked + .radio-custom {
    border-color: #667eea;
    background-color: #667eea;
}

.radio-label input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

/* Messages d'erreur */
.error-message {
    color: #e53e3e;
    font-size: 0.85rem;
    margin-top: 5px;
    display: none;
}

.error-message.show {
    display: block;
}

/* Contrôles du formulaire */
.form-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* Bouton test direct */
.direct-test-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    animation: directTestPulse 2s ease-in-out infinite alternate;
}

.direct-test-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
}

.direct-test-btn:active {
    transform: translateY(0);
}

@keyframes directTestPulse {
    from {
        box-shadow: 0 8px 20px rgba(255, 107, 107, 0.3);
    }
    to {
        box-shadow: 0 8px 20px rgba(255, 107, 107, 0.6);
    }
}

/* Bouton de soumission */
.submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px 30px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    flex: 1;
    min-width: 200px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Bouton mode test */
.test-mode-btn {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.test-mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(56, 161, 105, 0.3);
}

.test-mode-btn:active {
    transform: translateY(0);
}

.test-mode-btn.active {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    animation: testModePulse 1s ease-in-out infinite alternate;
}

@keyframes testModePulse {
    from {
        box-shadow: 0 8px 20px rgba(229, 62, 62, 0.3);
    }
    to {
        box-shadow: 0 8px 20px rgba(229, 62, 62, 0.6);
    }
}

/* btn-loading supprimé */

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Nouveau style pour le spinner du bouton (évite le conflit avec la roue) */
/* btn-spinner supprimé */


/* Écran de la roue */
.wheel-container {
    padding: 40px;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wheel-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 10px;
}

.wheel-header p {
    font-size: 1.1rem;
    color: #718096;
    margin-bottom: 40px;
}

.deal-wheel {
  --size: clamp(200px, 60vmin, 500px);
  --lg-hs: 0 3%;
  --lg-stop: 50%;
  --lg: linear-gradient(
      hsl(var(--lg-hs) 0%) 0 var(--lg-stop),
      hsl(var(--lg-hs) 20%) var(--lg-stop) 100%
    );
  
  position: relative;
  display: grid;
  grid-gap: calc(var(--size) / 20);
  align-items: center;
  justify-content: center;
  grid-template-areas:
    "spinner"
    "trigger";
  font-family: "Girassol", sans-serif;
  font-size: calc(var(--size) / 21);
  line-height: 1;
  text-transform: lowercase;
  margin: 0 auto;
}

.deal-wheel > * {
  grid-area: spinner;
}

.deal-wheel .btn-spin {
  grid-area: trigger;
  justify-self: center;
}

.spinner {
  position: relative;
  display: grid;
  align-items: center;
  grid-template-areas: "spinner";
  width: var(--size);
  height: var(--size);
  transform: rotate(calc(var(--rotate, 0) * 1deg));
  border-radius: 50%;
  box-shadow: inset 0 0 0 calc(var(--size) / 40) hsl(0deg 0% 0% / 0.06);
  /* S'assurer qu'aucune animation générique ne s'applique par héritage */
  animation: none;
}

.spinner * {
  grid-area: spinner;
}

.prize {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 calc(var(--size) / 6) 0 calc(var(--size) / 20);
  width: 50%;
  height: 50%;
  transform-origin: center right;
  transform: rotate(var(--rotate));
  user-select: none;
}

.prize .text {
  font-size: calc(var(--size) / 27);
  font-weight: 400;
  color: #2d3748;
  text-align: left;
}

.cap {
  --cap-size: calc(var(--size) / 4);
  position: relative;
  justify-self: center;
  width: var(--cap-size);
  height: var(--cap-size);
}

/* Hide select dropdown from SVG import file */
.cap select {
  display: none;
}

.cap svg {
  width: 100%;
}

.ticker {
  position: relative;
  left: calc(var(--size) / -15);
  width: calc(var(--size) / 10);
  height: calc(var(--size) / 20);
  background: var(--lg);
  z-index: 1;
  clip-path: polygon(20% 0, 100% 50%, 20% 100%, 0% 50%);
  transform-origin: center left;
}

.btn-spin {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px 30px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    flex: 1;
    min-width: 200px;
}

.btn-spin:focus {
  outline-offset: 2px;
}

.btn-spin:active {
  transform: translateY(1px);
}

.btn-spin:disabled {
  cursor: progress;
  opacity: 0.25;
}

/* Cercle central pour l'image */
.wheel-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 120px;
  transform: translate(-50%, -50%);
  background: rgb(0, 0, 0);
  border-radius: 50%;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.center-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

@media screen and (max-width: 768px) {
    .wheel-container {
        padding: 20px;
    }

    .deal-wheel {
        --size: clamp(200px, 75vmin, 400px);
    }

    .wheel-center {
        width: 80px;
        height: 80px;
    }

    .center-logo {
        width: 48px;
        height: 48px;
    }
}

/* Spinning animation */
/* On ne met pas de transition par défaut pour éviter tout spin auto */
.is-spinning .spinner {
  transition: transform 8s cubic-bezier(0.1, -0.01, 0, 1);
}

.is-spinning .ticker {
  animation: tick 700ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes tick {
  40% {
    transform: rotate(-12deg);
  }
}

/* Selected prize animation */
.prize.selected .text {
  color: white;
  animation: selected 800ms ease;
}

@keyframes selected {
  25% {
    transform: scale(1.25);
    text-shadow: 1vmin 1vmin 0 hsla(0 0% 0% / 0.1);
  }
  40% {
    transform: scale(0.92);
    text-shadow: 0 0 0 hsla(0 0% 0% / 0.2);
  }
  60% {
    transform: scale(1.02);
    text-shadow: 0.5vmin 0.5vmin 0 hsla(0 0% 0% / 0.1);
  }
  75% {
    transform: scale(0.98);
  }
  85% {
    transform: scale(1);
  }
}

/* Écran de résultat */
.result-container {
    padding: 60px 40px;
    text-align: center;
}

.result-content {
    max-width: 500px;
    margin: 0 auto;
}

.result-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.result-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 15px;
}

.result-message {
    font-size: 1.2rem;
    color: #718096;
    margin-bottom: 30px;
    line-height: 1.6;
}

.prize-details {
    background: #f7fafc;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    text-align: left;
}

.prize-details h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 15px;
}

.prize-details ul {
    list-style: none;
    padding: 0;
}

.prize-details li {
    padding: 8px 0;
    color: #4a5568;
    border-bottom: 1px solid #e2e8f0;
}

.prize-details li:last-child {
    border-bottom: none;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
    display: inline-block;
}

.action-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.action-btn.secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}