/* ============================================
   STEP3 STYLES - Tous les styles isolés sous #step3
   pour éviter les conflits avec d'autres composants
   ============================================ */

/* Main container */
#step3 {
    display: none;
}

/* Email verification banner */
#step3 #email-verification-banner {
    display: none;
    margin-bottom: 20px;
}

/* Section titles */
#step3 .step3-section-title {
    color: #01A6C7;
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 8px;
}

#step3 .step3-section-subtitle {
    color: #666;
    font-size: 14px;
    margin-bottom: 24px;
}

/* Saved addresses list */
#step3 #savedAddressesList {
    margin-bottom: 20px;
}

/* Address cards */
#step3 .address-card-customer {
    border: 2px solid #01A6C7;
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #F5F7FA;
    box-shadow: 0 2px 8px rgba(1, 166, 199, 0.15);
    margin-bottom: 12px;
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#step3 .address-card {
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    margin-bottom: 12px;
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#step3 .address-card.selected {
    border: 2px solid #01A6C7;
    background: #F5F7FA;
    box-shadow: 0 2px 8px rgba(1, 166, 199, 0.15);
}

/* Address card actions container */
#step3 .address-card-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

/* Action buttons container */
#step3 .address-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

/* Show action buttons on hover */
#step3 .address-card:hover .address-action-buttons,
#step3 .address-card-customer:hover .address-action-buttons {
    opacity: 1;
    visibility: visible;
}

/* Action buttons (Edit and Delete) */
#step3 .step3-btn-edit-address-card,
#step3 .step3-btn-delete-address-card {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    font-size: 12px;
    position: relative;
    z-index: 10;
}

#step3 .step3-btn-edit-address-card:focus,
#step3 .step3-btn-delete-address-card:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(1, 166, 199, 0.2);
}

#step3 .step3-btn-edit-address-card:hover {
    background: #e8e8e8;
    border-color: #d0d0d0;
    color: #01A6C7;
    transform: scale(1.1);
}

#step3 .step3-btn-delete-address-card:hover {
    background: #ffe8e8;
    border-color: #ffcccc;
    color: #d32f2f;
    transform: scale(1.1);
}

/* Address card header */
#step3 .address-card-header {
    color: #01A6C7;
    font-weight: 700;
    margin: 0 0 10px 0;
    font-size: 1rem;
    line-height: 1.4;
    flex: 1;
}

#step3 .address-card-header i {
    margin-right: 8px;
    font-size: 1rem;
    color: #01A6C7;
}

#step3 .address-card-name {
    display: inline;
    font-weight: 700;
    color: #01A6C7;
}

#step3 .address-card-label {
    color: #999;
    font-weight: 400;
    display: block;
    margin-top: 4px;
    font-size: 0.85rem;
}

/* Badge */
#step3 .address-badge {
    background: #01A6C7;
    color: white;
    padding: 5px 10px;
    border-radius: 18px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 600;
    margin-bottom: 0;
}

#step3 .address-badge i {
    margin-right: 5px;
}

/* Address card content */
#step3 .address-card-content {
    margin: 6px 0;
    color: #333;
    font-size: 14px;
    line-height: 1.4;
}

#step3 .address-card-content strong {
    color: #555;
    font-weight: 600;
    margin-right: 5px;
}

/* Hidden radio inputs */
#step3 .address-radio {
    display: none;
}

/* Alert info */
#step3 .step3-alert-info {
    background: linear-gradient(135deg, #F5F7FA 0%, #F5F7FA 100%);
    border: none;
    color: #003B66;
}

/* Hidden section */
#step3 #getDiffAddr {
    display: none;
}

/* ============================================
   BUTTONS - Styles isolés pour step3 uniquement
   ============================================ */

/* Bouton "Adresse bearbeiten" */
#step3 .step3-btn-edit-address {
    background: transparent;
    color: #01A6C7;
    border: 2px solid #01A6C7;
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 15px;
}

#step3 .step3-btn-edit-address:hover {
    background: #01A6C7;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(1, 166, 199, 0.3);
}

#step3 .step3-btn-edit-address:active {
    transform: translateY(0);
}

#step3 .step3-btn-edit-address i {
    margin-right: 8px;
}

/* Bouton "Neue Adresse" */
#step3 .step3-btn-add-address {
    background: #01A6C7;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 12px;
}

#step3 .step3-btn-add-address:hover {
    background: #0088a3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(1, 166, 199, 0.3);
}

#step3 .step3-btn-add-address:active {
    transform: translateY(0);
}

#step3 .step3-btn-add-address i {
    margin-right: 8px;
}

/* Bouton "Bestätigen und fortfahren" (Soumettre) */
#step3 .step3-btn-submit {
    background: #003B66;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 59, 102, 0.2);
}

#step3 .step3-btn-submit:hover {
    background: #002d4d;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 59, 102, 0.3);
}

#step3 .step3-btn-submit:active {
    transform: translateY(0);
}

#step3 .step3-btn-submit i {
    margin-right: 8px;
}

/* Bouton "Abbrechen" (Annuler) */
#step3 .step3-btn-cancel {
    background: white;
    color: #666;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 24px;
    font-weight: 400;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 0;
}

#step3 .step3-btn-cancel:hover {
    background: #f9f9f9;
    border-color: #d0d0d0;
    color: #333;
}

#step3 .step3-btn-cancel:active {
    transform: translateY(0);
}

#step3 .step3-btn-cancel i {
    margin-right: 8px;
    color: #333;
}

/* Bouton "Speichern" (Enregistrer) */
#step3 .step3-btn-save {
    background: #01A6C7;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(1, 166, 199, 0.2);
}

#step3 .step3-btn-save:hover {
    background: #0088a3;
    box-shadow: 0 4px 8px rgba(1, 166, 199, 0.3);
}

#step3 .step3-btn-save:active {
    transform: translateY(0);
}

#step3 .step3-btn-save i {
    margin-right: 8px;
}

/* New address form */
#step3 #newAddressForm {
    display: none;
    margin-top: 30px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#step3 .step3-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: white;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#step3 .step3-card-header {
    background: #01A6C7;
    color: white;
    border-radius: 12px 12px 0 0;
    padding: 16px 24px;
    display: flex;
    align-items: center;
}

#step3 .step3-card-header i {
    margin-right: 12px;
    font-size: 1.2rem;
}

#step3 .step3-card-title {
    margin: 0;
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
}

#step3 .step3-card-body {
    padding: 24px;
    background: white;
}

#step3 .step3-form-label {
    color: #01A6C7;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
    display: block;
    font-family: sans-serif;
}

/* Input fields */
#step3 #addAddressForm .form-control {
    background-color: #F5F7FA;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 15px;
    color: #333;
    transition: all 0.3s ease;
    width: 100%;
}

#step3 #addAddressForm .form-control:focus {
    background-color: white;
    border-color: #01A6C7;
    box-shadow: 0 0 0 3px rgba(1, 166, 199, 0.1);
    outline: none;
}

#step3 #addAddressForm .form-control::placeholder {
    color: #999;
}

/* Form row spacing */
#step3 #addAddressForm .row {
    margin: 0;
}

#step3 #addAddressForm .mb-3 {
    margin-bottom: 20px ;
}

/* Form buttons container */
#step3 #addAddressForm .text-right {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 8px;
}

/* Container des boutons */
#step3 .step3-buttons-container {
    display: flex;
    align-items: center;
    margin-top: 30px;
    margin-bottom: 20px;
}

/* Ajustement du layout général */
#step3 #delivery-form {
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

#step3 .row {
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Conteneur des cartes d'adresse */
#step3 #savedAddressesList {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#step3 #savedAddressesList .row {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
}

#step3 #savedAddressesList .col-md-12 {
    width: 100%;
    max-width: 100%;
    padding-left: 15px;
    padding-right: 15px;
    box-sizing: border-box;
    flex: 0 0 100%;
}

/* Assurer que les cartes ne s'étirent pas */
#step3 #savedAddressesList .col-md-12 .address-card,
#step3 #savedAddressesList .col-md-12 .address-card-customer {
    width: 50%;
    max-width: 50%;
    box-sizing: border-box;
    min-width: 0;
}

/* Conteneur principal */
#step3 > .row {
    width: 100%;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
}

#step3 > .row > #delivery-form {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#step3 > .row > #delivery-form > .col-md-12 {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding-left: 15px;
    padding-right: 15px;
}

/* ============================================
   MODAL DE CONFIRMATION - Styles pour le modal de suppression
   ============================================ */

/* Overlay du modal (hors de #step3 pour être toujours visible) */
.step3-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none; /* Masqué par défaut, affiché via JavaScript */
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.2s ease;
}

/* Modal visible */
.step3-modal-overlay[style*="flex"],
.step3-modal-overlay.show {
    display: flex;
}

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

/* Container du modal */
.step3-modal-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    position: relative;
}

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

/* Header du modal */
.step3-modal-header {
    background: linear-gradient(135deg, #01A6C7 0%, #0088a3 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.step3-modal-title {
    margin: 0;
    font-weight: 700;
    font-size: 1.25rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.step3-modal-title i {
    font-size: 1.2rem;
    color: #ffd700;
}

/* Body du modal */
.step3-modal-body {
    padding: 24px;
    color: #333;
}

.step3-modal-message {
    font-size: 16px;
    font-weight: 600;
    color: #003B66;
    margin: 0 0 10px 0;
    line-height: 1.5;
}

.step3-modal-submessage {
    font-size: 14px;
    color: #666;
    margin: 0;
    line-height: 1.4;
}

/* Footer du modal */
.step3-modal-footer {
    padding: 16px 24px;
    background: #F5F7FA;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid #e0e0e0;
}

/* Boutons du modal */
.step3-modal-btn-cancel,
.step3-modal-btn-confirm {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.step3-modal-btn-cancel {
    background: white;
    color: #666;
    border: 1px solid #e0e0e0;
}

.step3-modal-btn-cancel:hover {
    background: #f9f9f9;
    border-color: #d0d0d0;
    color: #333;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.step3-modal-btn-confirm {
    background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(211, 47, 47, 0.2);
}

.step3-modal-btn-confirm:hover {
    background: linear-gradient(135deg, #b71c1c 0%, #8b0000 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(211, 47, 47, 0.3);
}

.step3-modal-btn-confirm:active,
.step3-modal-btn-cancel:active {
    transform: translateY(0);
}

.step3-modal-btn-cancel i,
.step3-modal-btn-confirm i {
    font-size: 14px;
}

/* ============================================
   MOBILE OPTIMIZATION
   ============================================ */

   @media (max-width: 768px) {

    /* Les cartes prennent 100% de la largeur */
    #step3 #savedAddressesList .col-md-12 .address-card,
    #step3 #savedAddressesList .col-md-12 .address-card-customer {
        width: 100%;
        max-width: 100%;
    }

    /* Padding plus compact */
    #step3 .address-card,
    #step3 .address-card-customer {
        padding: 14px;
    }

    /* Titres légèrement plus grands pour lisibilité */
    #step3 .step3-section-title {
        font-size: 1.3rem;
    }

    #step3 .address-card-content {
        font-size: 15px;
        line-height: 1.5;
    }

    /* Boutons en colonne */
    #step3 .step3-buttons-container {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    #step3 .step3-btn-add-address,
    #step3 .step3-btn-edit-address,
    #step3 .step3-btn-submit,
    #step3 .step3-btn-cancel {
        width: 100%;
        margin-right: 0;
    }

    /* Boutons du formulaire */
    #step3 #addAddressForm .text-right {
        flex-direction: column;
        align-items: stretch;
    }

    #step3 #addAddressForm .text-right button {
        width: 100%;
    }

    /* Modal plus adapté mobile */
    .step3-modal-container {
        width: 95%;
        max-width: 95%;
    }

    .step3-modal-footer {
        flex-direction: column;
    }

    .step3-modal-btn-cancel,
    .step3-modal-btn-confirm {
        width: 100%;
        justify-content: center;
    }
}

/* Profil : zone miroir Step3 — le sélecteur #step3 est masqué par défaut (flux Assemble/JS) */
#step3.profile-step3-mirror {
    display: block !important;
}

/* Profil : grille des cartes (évite flex-direction: column du bloc #savedAddressesList Step3) */
#step3.profile-step3-mirror #savedAddressesList > .row {
    flex-direction: row;
    flex-wrap: wrap;
}