/* ═══════════════════════════════════════
   Hope Contact Form — Styles
   ═══════════════════════════════════════ */

/* Honeypot */
.hope-cf__honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

/* Form layout */
.hope-cf__form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.hope-cf__fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 5px;
}

.hope-cf__field {
    display: flex;
    flex-direction: column;
    width: calc(50% - 0.375rem);
    flex: 0 0 calc(50% - 0.375rem);
}

.hope-cf__field--full {
    width: 100%;
    flex: 0 0 100%;
}

/* Labels */
.hope-cf__label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--hope-cf-label, inherit);
}

.hope-cf__required {
    color: var(--hope-cf-error, #d63638);
    margin-left: 2px;
}

/* Inputs */
.hope-cf__input,
.hope-cf__textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--hope-cf-border, #ccc);
    border-radius: var(--radius-medium);
    background: var(--form-input-background);
    color: var(--title-color-primary, var(--hope-cf-text, #202020));
    font-family: inherit;
    transition: background-color .3s, border-color .3s, box-shadow .3s;
}

.hope-cf__input:hover,
.hope-cf__textarea:hover {
    border-color: var(--active-color, var(--hope-cf-focus, --active-color));
}

.hope-cf__input:focus-visible,
.hope-cf__textarea:focus-visible {
    outline: 0;
    border-color: var(--active-color, var(--hope-cf-focus, --active-color));
    box-shadow: var(--box-shadow-standard, none), 0 0 0 2px rgba(25, 117, 216, 0.2);
}

.hope-cf__textarea {
    resize: vertical;
    min-height: 130px;
}

/* Error states */
.hope-cf__input--error,
.hope-cf__textarea--error {
    border-color: var(--hope-cf-error, #d63638);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--hope-cf-error, #d63638) 12%, transparent);
}

.hope-cf__error {
    color: var(--hope-cf-error, #d63638);
    font-size: 0.78rem;
    margin-top: 0.25rem;
    display: none;
}

.hope-cf__general-error {
    background: color-mix(in srgb, var(--hope-cf-error, #d63638) 8%, #fff);
    border: 1px solid color-mix(in srgb, var(--hope-cf-error, #d63638) 30%, #fff);
    color: var(--hope-cf-error, #d63638);
    padding: 0.75rem 1rem;
    border-radius: var(--hope-cf-radius, 6px);
    font-size: 0.85rem;
    display: none;
}

/* Submit */
.hope-cf__submit {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60px;
    margin-top: 0.5rem;
}

.hope-cf__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    border: 1px solid transparent;
    border-radius: var(--hope-cf-radius, 6px);
    background: var(--hope-cf-accent, #0073aa);
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    min-width: 120px;
    transition: all 0.25s ease;
}

.hope-cf__button:hover:not(:disabled) {
    background: color-mix(in srgb, var(--hope-cf-accent, #0073aa) 85%, #000);
}

.hope-cf__button:focus-visible {
    outline: 2px solid var(--hope-cf-accent, #0073aa);
    outline-offset: 2px;
}

.hope-cf__button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Status icons */
.hope-cf__status-icon {
    display: none;
    width: 24px;
    height: 24px;
}

.hope-cf__status-icon svg {
    width: 100%;
    height: 100%;
}

.hope-cf__button--success,
.hope-cf__button--error {
    min-width: 48px !important;
    width: 48px !important;
    height: 48px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    transition: all 0.3s ease !important;
}

.hope-cf__button--success {
    background: var(--hope-cf-success, #28a745) !important;
    border-color: var(--hope-cf-success, #28a745) !important;
}

.hope-cf__button--error {
    background: var(--hope-cf-error, #d63638) !important;
    border-color: var(--hope-cf-error, #d63638) !important;
}

.hope-cf__button--success .hope-cf__status-icon,
.hope-cf__button--error .hope-cf__status-icon {
    display: inline-flex !important;
    color: #fff;
    animation: hopeCfPop 0.3s ease-out;
}

@keyframes hopeCfPop {
    from { opacity: 0; transform: scale(0.5); }
    to   { opacity: 1; transform: scale(1); }
}

/* Loader */
.hope-cf__button-loader {
    display: none;
}

.hope-cf__button-loader svg {
    vertical-align: middle;
}

/* Auth form */
.hope-cf__auth {
    max-width: 400px;
    margin: 2rem auto;
}

.hope-cf__auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem;
    border: 1px solid var(--hope-cf-border, #ccc);
    border-radius: var(--hope-cf-radius, 6px);
    background: var(--hope-cf-bg, #fff);
}

.hope-cf__auth-error {
    background: color-mix(in srgb, var(--hope-cf-error, #d63638) 8%, #fff);
    color: var(--hope-cf-error, #d63638);
    padding: 0.6rem 0.8rem;
    border-radius: var(--hope-cf-radius, 6px);
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 640px) {
    .hope-cf__field {
        width: 100%;
        flex: 0 0 100%;
    }

    .hope-cf__input,
    .hope-cf__textarea {
        font-size: 16px;
    }
}

/* ═══════════════════════════════════════
   Section wrapper (composant)
   ═══════════════════════════════════════ */

.hope-cf-section {
    max-width: var(--layout-small-width-system, 900px);
    width: var(--layout-full-width-system, 100%);
    margin: 0 auto;
}

.hope-cf-section__inner {
    max-width: var(--layout-small-width-system, 900px);
    width: var(--layout-full-width-system, 100%);
    margin: 0 auto;
}

.hope-cf-section__form {
    border-radius: var(--radius-xlarge, var(--hope-cf-radius, 6px));
    border-top: var(--element-border, 1px solid #eee);
    box-shadow: var(--box-shadow-standard, 0 2px 8px rgba(0, 0, 0, 0.06));
    position: relative;
    margin: 10px;
}

.hope-cf-section .submit-row {
    height: 60px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
}

/* ═══════════════════════════════════════
   Messages (success / error / warning)
   ═══════════════════════════════════════ */

.hope-cf__message {
    padding: 1rem;
    border-radius: var(--hope-cf-radius, 6px);
    margin-bottom: 1.25rem;
}

.hope-cf__message--success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.hope-cf__message--error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.hope-cf__message--success h3 {
    margin: 0 0 0.625rem 0;
    font-size: 1.125rem;
}

.hope-cf__message--success p {
    margin: 0;
}

.hope-cf__warning {
    margin-top: 0.625rem;
    padding-top: 0.625rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Error list */
.hope-cf__errors {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 1rem;
    border-radius: var(--hope-cf-radius, 6px);
    margin-bottom: 1.25rem;
}

.hope-cf__errors ul {
    margin: 0;
    padding-left: 1.25rem;
}

.hope-cf__errors li {
    margin-bottom: 0.3rem;
}

.hope-cf__errors li:last-child {
    margin-bottom: 0;
}

/* ═══════════════════════════════════════
   External button (bouton hors du <form>)
   ═══════════════════════════════════════ */

.hope-cf__button-external {
    color: var(--color-ts-white, #fff);
    padding: 0.5rem 1.2rem;
    border: 1px solid transparent;
    border-radius: var(--radius-interactive-button, 4px);
    font-family: var(--font-family-ts, inherit);
    font-weight: 400;
    transition: var(--ease-transition-medium, all 0.2s ease);
    font-size: 0.9rem;
    background-color: var(--active-color, var(--hope-cf-accent, var(--active-color)));
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    cursor: pointer;
    min-width: 100px;
}

.hope-cf__button-external:hover:not(:disabled),
.hope-cf__button-external:focus-visible:not(:disabled) {
    color: var(--active-color, var(--hope-cf-accent, var(--active-color)));
    border-radius: var(--radius-interactive-button, 4px);
    background: none;
    border-color: var(--active-color, var(--hope-cf-accent, var(--active-color)));
}

.hope-cf__button-external:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* External button status states */
.btn.hope-cf__button--success,
.btn.hope-cf__button--error {
    min-width: 50px;
    width: 50px;
    height: 50px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn.hope-cf__button--success {
    background-color: var(--hope-cf-success, #28a745);
    border-color: var(--hope-cf-success, #28a745);
    color: #fff;
}

.btn.hope-cf__button--error {
    background-color: var(--hope-cf-error, #d63638);
    border-color: var(--hope-cf-error, #d63638);
    color: #fff;
}

.btn.hope-cf__button--success .hope-cf__status-icon,
.btn.hope-cf__button--error .hope-cf__status-icon {
    display: inline-flex !important;
    color: #fff;
    animation: hopeCfPop 0.3s ease-out;
}

.btn.hope-cf__button--success.fade-out {
    animation: hopeCfFadeOut 0.5s ease-out forwards;
}

@keyframes hopeCfFadeOut {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.5); }
}

/* Loading state */
.hope-cf__form--loading .hope-cf__button-text {
    display: none;
}

.hope-cf__form--loading .hope-cf__button-loader {
    display: inline-block;
}

/* ═══════════════════════════════════════
   Theme integration overrides
   ═══════════════════════════════════════ */

.hope-cf__field {
    border-top: var(--element-border, 1px solid #eee);
    box-shadow: var(--box-shadow-standard, 0 2px 8px rgba(0, 0, 0, 0.06));
    border-radius: var(--radius-large, 8px);
    padding: 5px;
}

.hope-cf__field label {
    color: var(--form-label-color, var(--title-color-secondary, inherit));
    display: block;
    font-family: var(--font-family-ts, inherit);
    font-size: 0.8rem;
    font-weight: 300;
    font-style: italic;
    margin-top: 3px;
    margin-left: 5px;
    margin-bottom: 0.5rem;
}

.hope-cf__input {
    height: 43px;
}

.hope-cf__input:hover,
.hope-cf__textarea:hover {
    border-color: var(--active-color, var(--hope-cf-focus, var(--active-color)));
}

.hope-cf__input:focus-visible,
.hope-cf__textarea:focus-visible {
    border-color: var(--active-color, var(--hope-cf-focus, var(--active-color)));
    box-shadow: var(--box-shadow-standard, none), 0 0 3px 0 var(--active-color);
    outline: 0;
}

.hope-cf__input::-moz-placeholder,
.hope-cf__textarea::-moz-placeholder {
    color: var(--placeholder-color, #8a8a8a);
    opacity: 0.7;
}

.hope-cf__input::placeholder,
.hope-cf__textarea::placeholder {
    color: var(--placeholder-color, #8a8a8a);
    opacity: 0.7;
}