/*
 * SP Devis — modal.css
 * Design aligné sur le thème SP Theme :
 *   Couleur primaire : #10b981 / #059669
 *   Couleur sombre   : #0f1923
 *   Police           : Plus Jakarta Sans (hérité du thème)
 *   Rayon            : 12–16px
 */

/* ── Variables locales ──────────────────────────────────────────────────── */
:root {
    --spd-green:       #10b981;
    --spd-green-dark:  #059669;
    --spd-ink:         #0f1923;
    --spd-ink2:        #4b5563;
    --spd-ink3:        #9ca3af;
    --spd-ln:          #e5e7eb;
    --spd-bg:          #f9fafb;
    --spd-white:       #ffffff;
    --spd-red:         #ef4444;
    --spd-radius:      14px;
    --spd-shadow:      0 24px 80px rgba(0, 0, 0, 0.22);
    --spd-transition:  0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Overlay ────────────────────────────────────────────────────────────── */
.spd-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(15, 25, 35, 0.72);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 6vh 1rem 1rem;
    opacity: 0;
    transition: opacity var(--spd-transition);
    overflow-y: auto;
}

.spd-overlay[hidden] {
    display: none !important;
}

.spd-overlay.spd-visible {
    opacity: 1;
}

/* ── Modal container ────────────────────────────────────────────────────── */
.spd-modal {
    background: var(--spd-white);
    border-radius: var(--spd-radius);
    box-shadow: var(--spd-shadow);
    width: 100%;
    max-width: 560px;
    position: relative;
    padding: 0;
    transform: translateY(-16px) scale(0.97);
    transition: transform var(--spd-transition);
    overflow: hidden;
}

.spd-overlay.spd-visible .spd-modal {
    transform: translateY(0) scale(1);
}

/* ── Close button ───────────────────────────────────────────────────────── */
.spd-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.9);
    transition: background var(--spd-transition), transform var(--spd-transition);
    padding: 0;
}

.spd-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.08);
}

/* Le bouton "Fermer" dans le bloc succès a un style différent */
.spd-success .spd-close {
    position: static;
    background: var(--spd-green);
    border-color: var(--spd-green);
    color: #fff;
    width: auto;
    height: auto;
    border-radius: 8px;
    padding: 0.65rem 1.5rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.spd-success .spd-close:hover {
    background: var(--spd-green-dark);
    border-color: var(--spd-green-dark);
    transform: translateY(-1px);
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.spd-header {
    background: linear-gradient(135deg, #0f1923 0%, #0d3320 100%);
    padding: 1.75rem 1.75rem 1.6rem;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.spd-header__icon {
    background: rgba(16, 185, 129, 0.18);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 10px;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--spd-green);
    margin-top: 2px;
}

.spd-header__title {
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.2;
    margin: 0 0 0.3rem;
}

.spd-header__sub {
    color: rgba(255, 255, 255, 0.52);
    font-size: 0.78rem;
    line-height: 1.5;
    margin: 0;
}

/* ── Form wrap ──────────────────────────────────────────────────────────── */
#spDevisFormWrap {
    padding: 1.5rem 1.75rem 1.75rem;
}

/* ── Field layout ───────────────────────────────────────────────────────── */
.spd-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

@media (max-width: 480px) {
    .spd-row {
        grid-template-columns: 1fr;
    }
}

.spd-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.9rem;
}

/* ── Label ──────────────────────────────────────────────────────────────── */
.spd-label {
    color: var(--spd-ink);
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    display: block;
}

.spd-required {
    color: var(--spd-red);
    margin-left: 2px;
}

/* ── Input / Textarea ───────────────────────────────────────────────────── */
.spd-input {
    background: var(--spd-bg);
    border: 1.5px solid var(--spd-ln);
    border-radius: 10px;
    color: var(--spd-ink);
    font-family: inherit;
    font-size: 0.85rem;
    line-height: 1.5;
    outline: none;
    padding: 0.68rem 0.95rem;
    transition: border-color var(--spd-transition), box-shadow var(--spd-transition);
    width: 100%;
    box-sizing: border-box;
}

.spd-input::placeholder {
    color: var(--spd-ink3);
}

.spd-input:focus {
    border-color: var(--spd-green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
    background: #fff;
}

.spd-input.spd-input--error {
    border-color: var(--spd-red);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.spd-textarea {
    resize: vertical;
    min-height: 96px;
}

/* ── Error messages ─────────────────────────────────────────────────────── */
.spd-error {
    color: var(--spd-red);
    font-size: 0.73rem;
    margin-top: 0.28rem;
    display: block;
    min-height: 1em;
    font-weight: 600;
}

.spd-global-error {
    background: #fee2e2;
    border: 1.5px solid #fca5a5;
    border-radius: 9px;
    color: #991b1b;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.spd-global-error[hidden] {
    display: none;
}

/* ── Submit button ──────────────────────────────────────────────────────── */
.spd-submit {
    background: var(--spd-green);
    border: none;
    border-radius: 9px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    padding: 0.82rem 1.5rem;
    width: 100%;
    transition: background var(--spd-transition), transform var(--spd-transition), box-shadow var(--spd-transition);
    margin-top: 0.35rem;
}

.spd-submit:hover:not(:disabled) {
    background: var(--spd-green-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

.spd-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.spd-submit__icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Animation de chargement */
.spd-submit.spd-loading .spd-submit__icon svg {
    display: none;
}

.spd-submit.spd-loading .spd-submit__icon::before {
    content: '';
    display: block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spd-spin 0.7s linear infinite;
}

@keyframes spd-spin {
    to { transform: rotate(360deg); }
}

/* ── Legal text ─────────────────────────────────────────────────────────── */
.spd-legal {
    color: var(--spd-ink3);
    font-size: 0.7rem;
    line-height: 1.6;
    margin: 0.85rem 0 0;
    text-align: center;
}

/* ── Honeypot (invisible) ───────────────────────────────────────────────── */
.spd-hp {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    pointer-events: none;
}

/* ── Success state ──────────────────────────────────────────────────────── */
.spd-success {
    padding: 2.5rem 1.75rem 2.25rem;
    text-align: center;
}

.spd-success[hidden] {
    display: none;
}

.spd-success__icon {
    background: #d1fae5;
    border: 2px solid #a7f3d0;
    border-radius: 50%;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    color: var(--spd-green-dark);
}

.spd-success__title {
    color: var(--spd-ink);
    font-size: 1.2rem;
    font-weight: 800;
    margin: 0 0 0.65rem;
}

.spd-success__msg {
    color: var(--spd-ink2);
    font-size: 0.88rem;
    line-height: 1.75;
    margin: 0 0 1.5rem;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .spd-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .spd-modal {
        max-width: 100%;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        max-height: 96vh;
        overflow-y: auto;
    }

    .spd-header {
        padding: 1.4rem 1.25rem 1.25rem;
    }

    #spDevisFormWrap {
        padding: 1.25rem 1.25rem 1.5rem;
    }
}
