/**
 * Styles pour le système de géolocalisation
 */

/* === Conteneur de carte === */
.location-map-container {
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#location-map {
    height: 400px;
    width: 100%;
    border-radius: 8px;
}

/* === Contrôles de la carte === */
.map-controls {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.map-controls .btn-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.map-controls .search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.map-controls .search-box input {
    flex: 1;
}

#coords-display {
    font-size: 0.9em;
    color: #666;
    margin-top: 10px;
}

#detected-address {
    margin-top: 10px;
}

/* === Formulaire de localisation === */
.location-form-section {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.location-form-section h4 {
    margin-bottom: 20px;
    color: #333;
    font-weight: 600;
}

.location-details-group {
    margin-bottom: 20px;
}

.location-details-group label {
    font-weight: 500;
    color: #555;
    margin-bottom: 8px;
}

.location-details-group textarea {
    min-height: 100px;
}

.location-details-group .help-text {
    font-size: 0.85em;
    color: #6c757d;
    margin-top: 5px;
}

/* === Gestion des photos de localisation === */
.location-photos-container {
    margin: 20px 0;
}

.photo-upload-area {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
}

.photo-upload-area:hover {
    border-color: #007bff;
    background: #e7f3ff;
}

.photo-upload-area .upload-icon {
    font-size: 3em;
    color: #007bff;
    margin-bottom: 15px;
}

.photo-upload-area .upload-text {
    color: #555;
    font-size: 0.95em;
}

.photo-input {
    display: none;
}

.photo-preview-area {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.photo-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    aspect-ratio: 1;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-item .remove-photo {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
}

.photo-item .remove-photo:hover {
    opacity: 1;
}

/* === Exemple de photos === */
.example-photos {
    margin: 15px 0;
    padding: 15px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
}

.example-photos h5 {
    color: #856404;
    font-size: 0.95em;
    margin-bottom: 10px;
}

.example-photos ul {
    margin: 0;
    padding-left: 20px;
    color: #856404;
}

.example-photos ul li {
    margin-bottom: 5px;
    font-size: 0.9em;
}

/* === Carte dans les détails de livraison === */
.delivery-location-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.delivery-location-card .location-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.delivery-location-card .location-header i {
    font-size: 1.5em;
    color: #007bff;
}

.delivery-location-card .location-header h5 {
    margin: 0;
    font-weight: 600;
}

.delivery-location-info {
    margin-bottom: 15px;
}

.delivery-location-info .info-item {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.delivery-location-info .info-item i {
    color: #007bff;
    width: 20px;
    text-align: center;
}

.delivery-location-info .info-item .info-content {
    flex: 1;
}

.delivery-location-info .info-item .info-label {
    font-weight: 600;
    font-size: 0.9em;
    color: #555;
}

.delivery-location-info .info-item .info-value {
    color: #333;
}

/* === Photos de localisation dans les détails === */
.location-photos-display {
    margin-top: 15px;
}

.location-photos-display h6 {
    margin-bottom: 10px;
    color: #555;
    font-weight: 600;
}

.location-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.location-photo-thumb {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    aspect-ratio: 1;
}

.location-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.location-photo-thumb:hover img {
    transform: scale(1.05);
}

/* === Boutons d'action GPS === */
.gps-action-buttons {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.gps-action-buttons .btn {
    flex: 1;
}

/* === Badge de statut GPS === */
.gps-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
}

.gps-status-badge.has-gps {
    background: #d4edda;
    color: #155724;
}

.gps-status-badge.no-gps {
    background: #f8d7da;
    color: #721c24;
}

/* === Navigation pour livreurs === */
.delivery-navigation {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    padding: 15px;
    z-index: 1000;
}

.delivery-navigation .nav-buttons {
    display: flex;
    gap: 10px;
}

.delivery-navigation .nav-buttons .btn {
    flex: 1;
    font-weight: 600;
}

/* === Responsive === */
@media (max-width: 768px) {
    #location-map {
        height: 300px;
    }

    .photo-preview-area {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }

    .location-photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }

    .map-controls .btn-group {
        flex-direction: column;
    }

    .map-controls .search-box {
        flex-direction: column;
    }
}

/* === Lightbox pour agrandir les photos === */
.photo-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.photo-lightbox.active {
    display: flex;
}

.photo-lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.photo-lightbox .close-lightbox {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 2em;
    cursor: pointer;
    background: rgba(0,0,0,0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
