/**
 * Styles front-end du formulaire multi-étapes Delphine CM Demo
 */

/* ==================== CONTENEUR PRINCIPAL ==================== */
.dcm-wrapper {
    --dcm-red: #bc261a;
    --dcm-red-dark: #a51f15;
    --dcm-blue: #183f5a;
    --dcm-blue-dark: #032c41;
    --dcm-black: #201a3c;
    --dcm-white: #ffffff;
    --dcm-border: rgba(24, 63, 90, 0.12);
    --dcm-border-strong: rgba(24, 63, 90, 0.2);
    max-width: 680px;
    margin: 2rem auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    color: #1a1a2e;
}

/* ==================== BARRE DE PROGRESSION ==================== */
.dcm-progress {
    background: #e8e8ef;
    border-radius: 20px;
    height: 32px;
    overflow: hidden;
    margin-bottom: 2rem;
    position: relative;
}

.dcm-progress-bar {
    background: var(--dcm-blue);
    height: 100%;
    border-radius: 20px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
}

.dcm-progress-text {
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

/* ==================== ÉTAPES ==================== */
.dcm-step {
    display: none;
    background: #ffffff;
    border-radius: 16px;
    padding: 2.5rem 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.04);
    border: 1px solid #e8e8ef;
    animation: dcm-fadeIn 0.4s ease;
}

.dcm-step-active {
    display: block;
}

@keyframes dcm-fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Icône d'étape */
.dcm-step-icon {
    text-align: center;
    margin-bottom: 1rem;
    color: #4f46e5;
}

.dcm-icon-success {
    color: #059669;
}

/* Titres */
.dcm-step h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 0.5rem 0;
    text-align: center;
}

.dcm-description {
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 1.5rem 0;
    text-align: center;
}

/* ==================== CHAMPS DE FORMULAIRE ==================== */
.dcm-step textarea,
.dcm-step input[type="email"] {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    line-height: 1.6;
    font-family: inherit;
    color: #1a1a2e;
    background: #f8fafc;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    resize: vertical;
}

.dcm-field-tools {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
}

.dcm-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--dcm-border-strong);
    border-radius: 12px;
    background: var(--dcm-white);
    color: var(--dcm-blue);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dcm-btn-secondary:hover {
    background: var(--dcm-blue);
    border-color: var(--dcm-blue);
    color: var(--dcm-white);
}

.dcm-btn-secondary:focus {
    outline: none;
    background: var(--dcm-blue);
    border-color: var(--dcm-blue);
    color: var(--dcm-white);
}

.dcm-field-help {
    margin: 0.75rem 0 0;
    color: #64748b;
    font-size: 0.88rem;
    line-height: 1.5;
}

.dcm-step textarea:focus,
.dcm-step input[type="email"]:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
    background: #fff;
}

.dcm-step input[type="email"] {
    font-size: 1.1rem;
    padding: 1rem 1.2rem;
}

/* ==================== SECTION AUDIO ==================== */
.dcm-audio-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

/* Bouton micro : gros et bien visible */
.dcm-mic-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 42px;
    padding: 0.7rem 1rem;
    background: var(--dcm-red);
    border: 1px solid var(--dcm-red);
    border-radius: 12px;
    color: var(--dcm-white);
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dcm-mic-btn svg {
    flex-shrink: 0;
}

.dcm-mic-btn:hover {
    background: var(--dcm-red-dark);
    border-color: var(--dcm-red-dark);
    color: var(--dcm-white);
}

.dcm-mic-btn:focus {
    outline: none;
    background: var(--dcm-red-dark);
    border-color: var(--dcm-red-dark);
    color: var(--dcm-white);
}

/* État : enregistrement en cours */
.dcm-mic-btn.dcm-recording {
    background: var(--dcm-red-dark);
    border-color: var(--dcm-red-dark);
    animation: dcm-pulse 1.5s infinite;
}

@keyframes dcm-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(239, 68, 68, 0);
    }
}

/* Timer d'enregistrement */
.dcm-recording-timer {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ef4444;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
}

/* ==================== LECTEUR AUDIO (prévisualisation) ==================== */
.dcm-audio-player {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: 0.8rem;
    padding: 0.8rem 1rem;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
}

.dcm-audio-player audio {
    flex: 1;
    height: 36px;
    min-width: 0;
}

/* Bouton supprimer l'audio */
.dcm-btn-audio-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 34px;
    padding: 0.5rem 0.75rem;
    background: var(--dcm-white);
    border: 1px solid rgba(188, 38, 26, 0.22);
    border-radius: 12px;
    color: var(--dcm-red);
    font-size: 0.82rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.dcm-btn-audio-delete:hover {
    background: var(--dcm-red);
    border-color: var(--dcm-red);
    color: var(--dcm-white);
}

.dcm-btn-audio-delete:focus {
    outline: none;
    background: var(--dcm-red);
    border-color: var(--dcm-red);
    color: var(--dcm-white);
}

/* ==================== BOUTONS ==================== */
.dcm-btn-group {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
    gap: 1rem;
}

.dcm-btn-group-right {
    justify-content: flex-end;
}

.dcm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.7rem 1rem;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    line-height: 1.2;
}

.dcm-btn-next {
    background: var(--dcm-blue);
    border-color: var(--dcm-blue);
    color: var(--dcm-white);
}

.dcm-btn-next:hover,
.dcm-btn-next:focus {
    background: var(--dcm-white);
    border-color: var(--dcm-blue);
    color: var(--dcm-blue);
    outline: none;
}

.dcm-btn-next:active {
    background: var(--dcm-blue);
    border-color: var(--dcm-blue);
}

.dcm-btn-next:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.dcm-btn-prev {
    background: var(--dcm-blue);
    border-color: var(--dcm-blue);
    color: var(--dcm-white);
}

.dcm-btn-prev:hover,
.dcm-btn-prev:focus {
    background: var(--dcm-white);
    border-color: var(--dcm-blue);
    color: var(--dcm-blue);
    outline: none;
}

/* ==================== LOADING / ERREUR ==================== */
.dcm-loading {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: 1rem;
    color: #64748b;
    font-size: 0.9rem;
}

.dcm-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e2e8f0;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: dcm-spin 0.6s linear infinite;
}

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

.dcm-error {
    margin-top: 1rem;
    padding: 0.8rem 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 0.9rem;
}

.dcm-step-feedback {
    display: none;
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.dcm-step-feedback.is-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.dcm-step-feedback.is-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
}

.dcm-step-feedback.is-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}

/* ==================== ÉTAPE 5 : MERCI / CALENDRIER ==================== */
.dcm-thankyou {
    text-align: center;
    padding: 2rem 0;
}

.dcm-thankyou h3 {
    font-size: 1.8rem;
    color: #059669;
    margin-bottom: 1rem;
}

.dcm-thankyou p {
    color: #64748b;
    font-size: 1rem;
    line-height: 1.7;
    max-width: 480px;
    margin: 0 auto;
}

.dcm-embed-calendar {
    margin-top: 1.5rem;
    border-radius: 12px;
    overflow: hidden;
    min-height: 200px;
}

.dcm-embed-calendar iframe {
    max-width: 100%;
}

.dcm-confirmation-summary {
    margin-bottom: 1.5rem;
    padding: 1rem 1.1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.dcm-confirmation-summary p {
    margin: 0.35rem 0;
    color: #334155;
}

.dcm-confirmation-title {
    font-weight: 700;
    color: #0f172a;
}

.dcm-webhook-status.is-success {
    color: #047857;
}

.dcm-webhook-status.is-error {
    color: #b91c1c;
}

.dcm-webhook-status.is-info {
    color: #1d4ed8;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 640px) {
    .dcm-wrapper {
        margin: 1rem;
    }

    .dcm-step {
        padding: 1.5rem 1.2rem;
    }

    .dcm-step h3 {
        font-size: 1.2rem;
    }

    .dcm-btn {
        padding: 0.7rem 1.5rem;
        font-size: 0.9rem;
    }

    .dcm-btn-group {
        flex-direction: column-reverse;
    }

    .dcm-btn-group-right {
        flex-direction: column;
    }

    .dcm-progress-bar {
        min-width: 90px;
    }

    .dcm-progress-text {
        font-size: 0.7rem;
    }

    .dcm-audio-section {
        flex-direction: column;
        align-items: stretch;
    }

    .dcm-field-tools {
        justify-content: stretch;
    }

    .dcm-btn-secondary {
        width: 100%;
    }

    .dcm-mic-btn {
        justify-content: center;
    }

    .dcm-audio-player {
        flex-direction: column;
    }

    .dcm-audio-player audio {
        width: 100%;
    }
}
