/* css/cf7-adresse-autocomplete.css */

/* Container principal */
.cf7-adresse-container {
    margin: 20px 0;
    position: relative;
}

/* Groupe de recherche */
.cf7-adresse-search-group {
    position: relative;
}

.cf7-adresse-search-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.cf7-adresse-search-group .required {
    color: #dc3545;
    margin-left: 3px;
}

/* Champ de recherche */
.cf7-adresse-search {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
    background: white;
}

.cf7-adresse-search:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.cf7-adresse-search::placeholder {
    color: #999;
    font-style: italic;
}

/* Liste de suggestions */
.cf7-adresse-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: -6px;
}

.cf7-adresse-suggestion-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cf7-adresse-suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cf7-adresse-suggestion-item:last-child {
    border-bottom: none;
}

.cf7-adresse-suggestion-item:hover,
.cf7-adresse-suggestion-item.active {
    background-color: #f0f8ff;
}

.cf7-adresse-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.cf7-adresse-label {
    flex: 1;
    color: #333;
    font-size: 14px;
}

/* Messages */
.cf7-adresse-loading,
.cf7-adresse-error,
.cf7-adresse-no-results {
    padding: 15px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.cf7-adresse-loading {
    color: #0073aa;
}

.cf7-adresse-error {
    color: #dc3545;
}

.cf7-adresse-no-results {
    color: #999;
    font-style: italic;
}

/* Détails de l'adresse sélectionnée */
.cf7-adresse-details {
    padding: 20px;
    background: linear-gradient(135deg, #e7f5e7 0%, #d4edda 100%);
    border-left: 4px solid #28a745;
    border-radius: 6px;
    animation: slideInFromTop 0.4s ease-out;
}

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

.cf7-adresse-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.cf7-adresse-row:last-of-type {
    margin-bottom: 0;
}

.cf7-adresse-col {
    flex: 1;
}

.cf7-adresse-col-small {
    flex: 0 0 120px;
}

.cf7-adresse-details label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 600;
    color: #155724;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cf7-adresse-details input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    background: white;
    color: #333;
    font-size: 14px;
}

.cf7-adresse-details input:focus {
    outline: none;
    border-color: #28a745;
}

/* Bouton modifier */
.cf7-adresse-change {
    margin-top: 15px;
    padding: 8px 15px;
    background: #f8f9fa;
    color: #333;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.cf7-adresse-change:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.cf7-adresse-change:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .cf7-adresse-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .cf7-adresse-col-small {
        flex: 1;
    }
    
    .cf7-adresse-search {
        font-size: 16px; /* Évite le zoom sur iOS */
    }
    
    .cf7-adresse-suggestions {
        max-height: 300px;
    }
    
    .cf7-adresse-details {
        padding: 15px;
    }
}

/* Scrollbar personnalisée pour les suggestions */
.cf7-adresse-suggestions::-webkit-scrollbar {
    width: 8px;
}

.cf7-adresse-suggestions::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.cf7-adresse-suggestions::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.cf7-adresse-suggestions::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Animation pour l'apparition des suggestions */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cf7-adresse-suggestions {
    animation: fadeInDown 0.2s ease-out;
}

/* Accessibilité */
.cf7-adresse-search:focus,
.cf7-adresse-change:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Validation CF7 */
.wpcf7-not-valid .cf7-adresse-search {
    border-color: #dc3545;
}

.wpcf7-not-valid-tip {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
}

/* Mode sombre (optionnel) */
@media (prefers-color-scheme: dark) {
    .cf7-adresse-search {
        background: #2b2b2b;
        border-color: #444;
        color: #fff;
    }
    
    .cf7-adresse-suggestions {
        background: #2b2b2b;
        border-color: #444;
    }
    
    .cf7-adresse-suggestion-item {
        color: #fff;
        border-bottom-color: #444;
    }
    
    .cf7-adresse-suggestion-item:hover,
    .cf7-adresse-suggestion-item.active {
        background-color: #3a3a3a;
    }
    
    .cf7-adresse-details input {
        background: #2b2b2b;
        border-color: #444;
        color: #fff;
    }
}
