* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #fafafa;
    color: #2d3748;
    line-height: 1.5;
    min-height: 100vh;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.hidden { 
    display: none !important; 
}

/* Conteneur principal */
#main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-height: 100vh;
    padding: 40px;
    max-width: 500px;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 300;
    margin-bottom: 24px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: #2d3748;
    letter-spacing: -0.02em;
}

h1:hover { 
    opacity: 0.7;
    transform: translateY(-1px);
}

#contact-link {
    color: #22c55e;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding-bottom: 2px;
}

#contact-link:hover { 
    border-bottom-color: #22c55e;
    transform: translateX(4px);
}

#contact-link:focus {
    outline: 2px solid #22c55e;
    outline-offset: 4px;
    border-radius: 2px;
}

/* Formulaire */
#form {
    width: 100%;
    max-width: 420px;
    margin-top: 24px;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.field {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}

input, textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: #374151;
}

input:focus, textarea:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
    transform: translateY(-1px);
}

input:hover, textarea:hover {
    border-color: #d1d5db;
}

textarea {
    height: 100px;
    resize: vertical;
    min-height: 80px;
}

/* Captcha */
.captcha {
    margin: 24px 0;
    padding: 20px;
    background: #f8fafc;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.captcha:hover {
    border-color: #d1d5db;
}

#captcha-text {
    font-weight: 500;
    color: #374151;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.captcha-calc {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
    /* Supprimez flex-wrap: wrap; */
}

#calc {
    font-weight: 600;
    min-width: 100px;
    font-size: 1.1rem;
    color: #2d3748;
}

#answer {
    width: 80px;
    text-align: center;
    font-weight: 500;
}

#refresh {
    background: transparent; /* Fond transparent */
    border: none; /* Supprimer la bordure */
    padding: 4px; /* Padding minimal */
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    flex-shrink: 0;
    border-radius: 4px; /* Garder un petit radius pour le hover */
}

#refresh:hover:not(:disabled) { 
    background: #f3f4f6; /* Léger fond gris au hover */

    transform: scale(1.1);
}

#refresh:disabled { 
    opacity: 0.5; 
    cursor: not-allowed;
    transform: none;
}

#captcha-feedback {
    font-size: 13px;
    min-height: 18px;
    font-weight: 500;
    margin-top: 8px;
}

.success { 
    color: #16a34a;
}

.error { 
    color: #dc2626;
}

/* Consentement */
.consent {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 20px 0;
    font-size: 14px;
    line-height: 1.5;
}

.consent input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: #22c55e;
    cursor: pointer;
}

.consent label {
    cursor: pointer;
    margin-bottom: 0;
    font-weight: 400;
    color: #4b5563;
}

#terms {
    color: #22c55e;
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

#terms:hover { 
    opacity: 0.8;
    text-decoration-thickness: 2px;
}

/* Boutons */
button {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    border: none;
    padding: 14px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    width: 100%;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    box-shadow: 0 2px 4px rgba(34, 197, 94, 0.2);
}

button:hover:not(:disabled) { 
    background: linear-gradient(135deg, #16a34a, #15803d);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(34, 197, 94, 0.3);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled { 
    opacity: 0.6; 
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

button:focus {
    outline: 2px solid #22c55e;
    outline-offset: 2px;
}

/* Status */
#status {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    display: none;
    transition: all 0.2s ease;
}

#status.show { 
    display: block;
    animation: statusSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes statusSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#status.success { 
    background: #dcfce7; 
    color: #166534;
    border: 1px solid #bbf7d0;
}

#status.error { 
    background: #fef2f2; 
    color: #991b1b;
    border: 1px solid #fecaca;
}

#status.loading { 
    background: #eff6ff; 
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

/* Modal */
#modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#modal > div {
    background: #fff;
    padding: 32px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    position: relative;
    margin: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: modalSlideIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#modal button {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #f3f4f6;
    color: #6b7280;
    border: none;
    font-size: 20px;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#modal button:hover {
    background: #e5e7eb;
    color: #374151;
    transform: scale(1.1);
}

#modal h3 {
    margin-bottom: 20px;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
}

#modal h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
}

#modal p {
    line-height: 1.6;
    color: #4b5563;
    font-size: 15px;
}

/* Page d'erreur */
#error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 40px;
}

#error h1 {
    margin-bottom: 32px;
    color: #2d3748;
}

#error p {
    font-size: 1.2rem;
    margin-bottom: 24px;
    color: #374151;
}

#countdown {
    color: #6b7280;
    font-size: 1rem;
}

#timer {
    font-weight: 600;
    color: #22c55e;
    font-size: 1.1rem;
}

/* Page succÃ¨s */
#success {
    text-align: center;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#success h2 {
    color: #16a34a;
    font-weight: 600;
    font-size: 1.8rem;
    margin-bottom: 8px;
}

#success button {
    margin-top: 20px;
    max-width: 200px;
}

/* Responsive */
@media (max-width: 640px) {
    #main { 
        padding: 20px;
        align-items: stretch;
    }
    
    h1 { 
        font-size: 2.5rem;
        margin-bottom: 20px;
        text-align: center;
        align-self: center;
    }
    
    #contact-link {
        text-align: center;
        align-self: center;
    }
    
    #form { 
        margin-top: 20px;
    }
    
    .captcha-calc { 
        gap: 8px;
        flex-wrap: nowrap; /* Forcer une seule ligne */
    }
    
    #calc {
        min-width: 70px;
        font-size: 0.9rem;
    }
    
    #answer {
        width: 60px;
    }
    
    #modal > div {
        padding: 24px;
        margin: 16px;
    }
    
    .consent {
        gap: 10px;
        font-size: 13px;
    }
    
    #refresh {

        min-width: 32px;
        height: 32px;
        padding: 2px;

        font-size: 14px;
    }
}

@media (max-width: 480px) {
    #main {
        padding: 16px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    input, textarea {
        padding: 10px 12px;
        font-size: 16px; /* Ã‰vite le zoom sur iOS */
    }
    
    button {
        padding: 12px 20px;
    }
    
    .captcha {
        padding: 16px;
    }
}

/* Performance optimisations */
* {
    will-change: auto;
}

button, input, textarea, #contact-link, h1 {
    will-change: transform;
}

/* AccessibilitÃ© */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}