/**
 * Geolocation Button Styles - Style RATP adapté Onselroute
 */

/* Bouton de géolocalisation */
.btn-geolocate {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    min-width: 42px;
    background: #EE6D00;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
    box-shadow: 0 2px 8px rgba(238, 109, 0, 0.3);
    flex-shrink: 0;
}

.btn-geolocate:hover {
    background: #d65f00;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(238, 109, 0, 0.4);
}

.btn-geolocate:active {
    transform: scale(0.95);
}

.btn-geolocate:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-geolocate svg {
    width: 20px;
    height: 20px;
    stroke: white;
    fill: none;
    stroke-width: 2;
}

/* État de chargement */
.btn-geolocate.loading {
    background: #EE6D00;
    animation: pulse-geolocate 1.5s infinite;
}

.geolocate-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin-geolocate 0.8s linear infinite;
}

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

@keyframes pulse-geolocate {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(238, 109, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(238, 109, 0, 0);
    }
}

/* État de succès */
.btn-geolocate.success {
    background: #28a745;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.btn-geolocate.success svg {
    stroke: white;
}

/* État d'erreur */
.btn-geolocate.error {
    background: #dc3545;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
    animation: shake-geolocate 0.5s;
}

@keyframes shake-geolocate {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* Tooltip d'erreur */
.geolocate-error-tooltip {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #dc3545;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    animation: fadeIn-tooltip 0.2s ease;
}

.geolocate-error-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 14px;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #dc3545;
}

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

/* Wrapper pour le champ + bouton */
.input-with-geolocate {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.input-with-geolocate .form-input {
    flex: 1;
}

/* Champs cachés pour coordonnées - ne pas afficher */
.hidden-coords {
    display: none;
}

/* Badge de distance */
.distance-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(238, 109, 0, 0.1);
    color: #EE6D00;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.distance-badge svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
}

/* Badge de distance sur les cartes de trajets */
.trip-card .distance-badge,
.trajet-card .distance-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Style pour les résultats triés par proximité */
.search-results-proximity {
    position: relative;
}

.search-results-proximity::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, #EE6D00, rgba(238, 109, 0, 0.1));
    border-radius: 2px;
}

/* Indicateur de position détectée */
.position-detected {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(238, 109, 0, 0.1);
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #333;
}

.position-detected svg {
    width: 18px;
    height: 18px;
    stroke: #EE6D00;
    fill: none;
}

.position-detected .position-text {
    flex: 1;
}

.position-detected .position-clear {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.position-detected .position-clear:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .btn-geolocate {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }

    .btn-geolocate svg {
        width: 18px;
        height: 18px;
    }

    .geolocate-error-tooltip {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        font-size: 0.8rem;
    }

    .geolocate-error-tooltip::before {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
    }
}
