/**
 * JSdev Forms - Styles Frontend
 */

/* ==========================================================================
   Base Form Styles
   ========================================================================== */

.jsdev-form {
    position: relative;
}

.jsdev-form.is-loading {
    pointer-events: none;
    opacity: 0.7;
}

.jsdev-form.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: jsdev-spin 0.8s linear infinite;
}

@keyframes jsdev-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Honeypot - must be hidden */
.jsdev-form .hp-field {
    position: absolute;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
}

/* ==========================================================================
   Form Message - Style unifie pour tous les formulaires
   ========================================================================== */

.form-message {
    display: none;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    margin-top: 16px;
    animation: formMessageSlideIn 0.3s ease-out;
}

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

.form-message__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-message__text {
    flex: 1;
    line-height: 1.4;
}

/* Success */
.form-message.success {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.15) 0%, rgba(40, 167, 69, 0.25) 100%);
    color: #4ade80;
    border: 1px solid rgba(40, 167, 69, 0.4);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.15);
}

/* Error */
.form-message.error {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.15) 0%, rgba(220, 53, 69, 0.25) 100%);
    color: #f87171;
    border: 1px solid rgba(220, 53, 69, 0.4);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.15);
}

/* Version claire (pour fonds clairs) */
.form-message--light.success {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1) 0%, rgba(40, 167, 69, 0.15) 100%);
    color: #16a34a;
}

.form-message--light.error {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(220, 53, 69, 0.15) 100%);
    color: #dc2626;
}

/* Newsletter specific - inline style */
.newsletter-left .form-message {
    max-width: 100%;
}

/* ==========================================================================
   Newsletter Form - 3 Columns Layout
   ========================================================================== */

.newsletter-wrapper {
    background: #07162a;
    border: 1.5px solid var(--mhb-secondary, #1e3a5f);
    border-radius: 18px;
    padding: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    margin: 40px auto;
    max-width: 1800px;
    position: relative;
    overflow: visible;
}

/* Colonne gauche */
.newsletter-left {
    width: 30%;
    flex-shrink: 0;
}

.newsletter-title {
    font-family: 'Formula Condensed', Arial, sans-serif;
    font-weight: 700;
    font-size: 44px;
    line-height: 1.05;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #fff;
    margin: 0 0 18px 0;
}

.newsletter-title .orange {
    color: #E95323;
}

.newsletter-desc {
    font-family: 'DM Sans', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.4;
    color: #fff;
    margin-bottom: 24px;
    max-width: 500px;
}

/* Newsletter Form */
.newsletter-form {
    display: flex;
    align-items: center;
    gap: 0;
    margin-top: 10px;
}

.newsletter-form input[type="email"] {
    flex: 1 1 0;
    padding: 15px 20px;
    border: 1px solid #fff;
    border-radius: 8px 0 0 8px;
    background: transparent;
    color: #fff;
    font-size: 16px;
    font-family: 'DM Sans', Arial, sans-serif;
    outline: none;
    transition: border 0.2s;
    height: 52px;
    box-sizing: border-box;
}

.newsletter-form input[type="email"]::placeholder {
    color: #fff;
    opacity: 0.7;
}

.newsletter-form input[type="email"]:focus {
    border-color: #E95323;
}

.newsletter-form button {
    background: #E95323;
    border: none;
    border-radius: 0 8px 8px 0;
    padding: 0 22px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.newsletter-form button:hover {
    background: #ff6a3c;
}

.newsletter-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.newsletter-form button .arrow {
    color: #fff;
    font-size: 22px;
    font-weight: bold;
}

/* Colonne centre */
.newsletter-center {
    width: 30%;
    text-align: right;
    font-family: 'Formula Condensed', Arial, sans-serif;
    font-weight: 300;
    font-size: 54px;
    padding-right: 80px;
    line-height: 1.1;
    color: #fff;
    text-transform: uppercase;
}

.newsletter-center .bold {
    font-weight: 700;
}

/* Colonne droite */
.newsletter-right {
    width: 30%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.newsletter-right img {
    position: absolute;
    width: 800px;
    max-width: none;
    height: auto;
    border-radius: 18px;
    box-shadow: none;
    right: -150px;
}

/* ==========================================================================
   Newsletter Responsive
   ========================================================================== */

@media (max-width: 1600px) {
    .newsletter-right img {
        width: 600px;
        right: -100px;
    }
}

@media (max-width: 1400px) {
    .newsletter-right img {
        width: 500px;
        right: -60px;
    }

    .newsletter-center {
        font-size: 44px;
        padding-right: 40px;
    }

    .newsletter-title {
        font-size: 36px;
    }
}

@media (max-width: 1100px) {
    .newsletter-wrapper {
        flex-wrap: wrap;
        padding: 30px;
        gap: 30px;
    }

    .newsletter-left {
        width: 55%;
    }

    .newsletter-center {
        width: 40%;
        padding-right: 20px;
        font-size: 38px;
    }

    .newsletter-right {
        width: 100%;
        justify-content: flex-end;
        min-height: 200px;
    }

    .newsletter-right img {
        position: relative;
        right: -30px;
        width: 350px;
    }
}

@media (max-width: 768px) {
    .newsletter-wrapper {
        flex-direction: column;
        text-align: center;
        padding: 30px 20px;
        gap: 20px;
    }

    .newsletter-left,
    .newsletter-center,
    .newsletter-right {
        width: 100%;
    }

    .newsletter-title {
        font-size: 32px;
    }

    .newsletter-desc {
        margin-left: auto;
        margin-right: auto;
    }

    .newsletter-center {
        text-align: center;
        padding-right: 0;
        font-size: 32px;
        order: -1;
        margin-bottom: 10px;
    }

    .newsletter-right {
        justify-content: center;
        min-height: auto;
        margin-top: 20px;
    }

    .newsletter-right img {
        position: relative;
        right: 0;
        width: 280px;
        max-width: 100%;
    }

    .newsletter-form {
        flex-direction: column;
        gap: 10px;
    }

    .newsletter-form input[type="email"] {
        border-radius: 8px;
        width: 100%;
    }

    .newsletter-form button {
        border-radius: 8px;
        width: 100%;
        padding: 15px 22px;
    }
}

/* ==========================================================================
   Generic Form Styles (Contact, etc.)
   ========================================================================== */

.jsdev-form-generic {
    max-width: 600px;
}

.jsdev-form-generic .form-group {
    margin-bottom: 1rem;
}

.jsdev-form-generic label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--mhb-text, #333);
}

.jsdev-form-generic input[type="text"],
.jsdev-form-generic input[type="email"],
.jsdev-form-generic input[type="tel"],
.jsdev-form-generic input[type="url"],
.jsdev-form-generic input[type="number"],
.jsdev-form-generic input[type="password"],
.jsdev-form-generic textarea,
.jsdev-form-generic select {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.jsdev-form-generic input:focus,
.jsdev-form-generic textarea:focus,
.jsdev-form-generic select:focus {
    outline: none;
    border-color: var(--mhb-primary, #001025);
    box-shadow: 0 0 0 3px rgba(0, 16, 37, 0.1);
}

.jsdev-form-generic textarea {
    min-height: 120px;
    resize: vertical;
}

.jsdev-form-generic button[type="submit"],
.jsdev-form-generic input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--mhb-primary, #001025);
    color: #fff;
}

.jsdev-form-generic button[type="submit"]:hover,
.jsdev-form-generic input[type="submit"]:hover {
    background: var(--mhb-secondary, #002855);
    transform: translateY(-1px);
}

.jsdev-form-generic button[type="submit"]:disabled,
.jsdev-form-generic input[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================================================
   MHB Form - Systeme de formulaires generique (dark theme)
   Reutilisable : espace presse, contact, inscription, etc.
   ========================================================================== */

.mhb-form-layout {
    max-width: 1000px;
    margin: 0 auto;
}

.mhb-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: start;
}

.mhb-form-grid--single {
    grid-template-columns: 1fr;
    max-width: 500px;
    margin: 0 auto;
}

/* Herite de .mhb-glass-block .mhb-glass-block--padded (sections.css) */
.mhb-form-block {
    /* Styles visuels via .mhb-glass-block en HTML */
}

.mhb-form-block__title {
    font-family: var(--mhb-font-display, 'Formula Condensed', sans-serif);
    font-size: 1.6rem;
    font-weight: 500;
    margin-bottom: 30px;
    color: var(--mhb-text-white, #fff);
}

/* Champs */
.mhb-form-field {
    margin-bottom: 20px;
}

.mhb-form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--mhb-text-white, #fff);
    font-size: 0.95rem;
}

.mhb-form-required {
    color: var(--mhb-accent, #E95323);
}

.mhb-form-field input[type="text"],
.mhb-form-field input[type="email"],
.mhb-form-field input[type="password"],
.mhb-form-field input[type="tel"],
.mhb-form-field input[type="url"],
.mhb-form-field input[type="number"],
.mhb-form-field select,
.mhb-form-field textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--mhb-radius-sm, 8px);
    color: var(--mhb-text-white, #fff);
    font-size: 1rem;
    font-family: var(--mhb-font-primary, 'DM Sans', sans-serif);
    transition: border-color var(--mhb-transition-fast, 0.2s ease);
}

.mhb-form-field input:focus,
.mhb-form-field select:focus,
.mhb-form-field textarea:focus {
    outline: none;
    border-color: var(--mhb-secondary, #007AC1);
}

.mhb-form-field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%23a0aec0'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.mhb-form-field select option {
    background: var(--mhb-bg-dark, #001025);
    color: var(--mhb-text-white, #fff);
}

.mhb-form-field small {
    display: block;
    margin-top: 5px;
    color: var(--mhb-text-gray, #a0aec0);
    font-size: 0.85rem;
}

.mhb-form-field textarea {
    resize: vertical;
    min-height: 80px;
}

/* ==========================================================================
   Checkbox custom (réutilisable)
   ========================================================================== */

.mhb-form-field--checkbox label {
    display: flex;
    align-items: flex-start;
    font-weight: normal;
    cursor: pointer;
    gap: 12px;
    line-height: 1.4;
}

.mhb-form-field--checkbox input[type="checkbox"] {
    /* Masquer la checkbox native */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    min-width: 22px;
    margin: 0;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    position: relative;
    transition: all var(--mhb-transition-fast, 0.2s ease);
    margin-top: 1px;
}

.mhb-form-field--checkbox input[type="checkbox"]:hover {
    border-color: var(--mhb-secondary, #007AC1);
    background: rgba(255, 255, 255, 0.12);
}

.mhb-form-field--checkbox input[type="checkbox"]:checked {
    background: var(--mhb-secondary, #007AC1);
    border-color: var(--mhb-secondary, #007AC1);
}

.mhb-form-field--checkbox input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 6px;
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.mhb-form-field--checkbox input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--mhb-secondary, #007AC1);
    outline-offset: 2px;
}

/* Variante fond clair */
.mhb-form-block--light .mhb-form-field--checkbox input[type="checkbox"] {
    border-color: #ccc;
    background: #f8f9fa;
}

.mhb-form-block--light .mhb-form-field--checkbox input[type="checkbox"]:hover {
    border-color: var(--mhb-secondary, #007AC1);
    background: #eef6fc;
}

/* Bouton submit */
.mhb-form-submit {
    width: 100%;
    padding: 16px;
    background: var(--mhb-secondary, #007AC1);
    color: #fff;
    border: none;
    border-radius: var(--mhb-radius-sm, 8px);
    font-size: 1.2rem;
    font-weight: 500;
    font-family: var(--mhb-font-display, 'Formula Condensed', sans-serif);
    cursor: pointer;
    transition: background var(--mhb-transition-base, 0.3s ease);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 10px;
}

.mhb-form-submit:hover {
    background: #0069a8;
}

/* Note sous formulaire */
.mhb-form-note {
    margin-top: 15px;
    text-align: center;
}

.mhb-form-note a {
    color: var(--mhb-secondary, #007AC1);
    text-decoration: none;
    transition: color var(--mhb-transition-fast, 0.2s ease);
}

.mhb-form-note a:hover {
    color: var(--mhb-accent, #E95323);
    text-decoration: underline;
}

/* Alertes formulaire */
.mhb-form-alert {
    padding: 14px 18px;
    border-radius: var(--mhb-radius-sm, 8px);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.mhb-form-alert p {
    margin: 0 0 4px 0;
}

.mhb-form-alert p:last-child {
    margin-bottom: 0;
}

.mhb-form-alert--error {
    background: rgba(220, 53, 69, 0.15);
    color: #ff8a8a;
    border-left: 4px solid #dc3545;
}

.mhb-form-alert--success {
    background: rgba(40, 167, 69, 0.15);
    color: #7dffaa;
    border-left: 4px solid #28a745;
}

/* Variante fond clair */
.mhb-form-block--light {
    background: #fff;
    border: 1px solid #eee;
}

.mhb-form-block--light .mhb-form-block__title {
    color: var(--mhb-text-dark, #1E1E1E);
}

.mhb-form-block--light .mhb-form-field label {
    color: var(--mhb-text-dark, #1E1E1E);
}

.mhb-form-block--light .mhb-form-field input[type="text"],
.mhb-form-block--light .mhb-form-field input[type="email"],
.mhb-form-block--light .mhb-form-field input[type="password"],
.mhb-form-block--light .mhb-form-field input[type="tel"],
.mhb-form-block--light .mhb-form-field select,
.mhb-form-block--light .mhb-form-field textarea {
    background: #f8f9fa;
    border-color: #dee2e6;
    color: var(--mhb-text-dark, #1E1E1E);
}

/* Responsive */
@media (max-width: 768px) {
    .mhb-form-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

@media (max-width: 576px) {
    .mhb-form-block__title {
        font-size: 1.3rem;
    }
}

/* ==========================================================================
   Form Row - Grille 2 colonnes pour les champs
   ========================================================================== */

.mhb-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 576px) {
    .mhb-form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* Intro text */
.mhb-form-intro {
    color: var(--mhb-text-gray, #a0aec0);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

/* ==========================================================================
   Captcha Styles
   ========================================================================== */

.jsdev-form .captcha-wrapper {
    margin: 1rem 0;
}

.jsdev-form .h-captcha,
.jsdev-form .g-recaptcha {
    transform-origin: left top;
}

@media (max-width: 400px) {
    .jsdev-form .h-captcha,
    .jsdev-form .g-recaptcha {
        transform: scale(0.9);
    }
}

/* ==========================================================================
   Math Captcha
   ========================================================================== */

.mhb-captcha {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mhb-captcha__question {
    font-family: var(--mhb-font-display, 'Formula Condensed', sans-serif);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--mhb-accent, #E95323);
    letter-spacing: 2px;
    white-space: nowrap;
    user-select: none;
}

.mhb-captcha__input {
    width: 70px !important;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 10px !important;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--mhb-radius-sm, 8px);
    color: var(--mhb-text-white, #fff);
    transition: border-color 0.2s ease;
}

.mhb-captcha__input:focus {
    outline: none;
    border-color: var(--mhb-secondary, #007AC1);
}

.mhb-captcha__input--error {
    border-color: #dc3545 !important;
    animation: captchaShake 0.4s ease;
}

@keyframes captchaShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.mhb-captcha__refresh {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.mhb-captcha__refresh:hover {
    color: var(--mhb-accent, #E95323);
    border-color: var(--mhb-accent, #E95323);
    transform: rotate(180deg);
}

.mhb-captcha-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--mhb-text-white, #fff);
    font-size: 0.95rem;
}
