/**
 * Location Map Styles
 * Production-ready styling for location selection module
 */

/* ============================================
   LEAFLET MAP CONTAINER
   ============================================ */

#locationMapContainer {
    width: 100%;
    height: 400px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    z-index: 10;
}

.location-map-wrapper {
    position: relative;
    margin-bottom: 1.5rem;
}

/* ============================================
   MAP CONTROLS AND UI ELEMENTS
   ============================================ */

/* Customize Leaflet controls */
.leaflet-control-zoom {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
    background-color: white !important;
    border: none !important;
    width: 40px !important;
    height: 40px !important;
    line-height: 40px !important;
    font-size: 16px !important;
    color: #4a6cf7 !important;
    cursor: pointer !important;
    transition: all 0.3s ease;
}

.leaflet-control-zoom-in:hover,
.leaflet-control-zoom-out:hover {
    background-color: #f8f9fa !important;
    color: #2d4ba8 !important;
}

/* Leaflet attribution */
.leaflet-attribution {
    background-color: rgba(255, 255, 255, 0.8) !important;
    padding: 4px 8px !important;
    font-size: 11px !important;
}

.leaflet-attribution a {
    color: #4a6cf7 !important;
    text-decoration: none;
}

.leaflet-attribution a:hover {
    text-decoration: underline;
}

/* ============================================
   LOCATION SEARCH INPUT & RESULTS
   ============================================ */

.location-search-container {
    position: relative;
    margin-bottom: 1.5rem;
    z-index: 15;
}

.location-search-input-group {
    display: flex;
    gap: 0.5rem;
}

.location-search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #9fa3a8;
    border-radius: 6px;
    background-color: #0e0e0d;
    color: #9fa3a8;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.location-search-input:focus {
    outline: none;
    border-color: #4a6cf7;
    color: #e9ecef;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.1);
}

.location-search-input::placeholder {
    color: #6c757d;
}

.location-search-btn {
    padding: 0.75rem 1.5rem;
    background-color: #4a6cf7;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.location-search-btn:hover {
    background-color: #2d4ba8;
    box-shadow: 0 4px 12px rgba(74, 108, 247, 0.3);
}

.location-search-btn:active {
    transform: scale(0.98);
}

.location-search-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.location-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #1a1a19;
    border: 1px solid #9fa3a8;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 20;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: none;
}

.location-search-results.active {
    display: block;
}

.location-search-result-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #333;
    cursor: pointer;
    transition: background-color 0.2s ease;
    color: #9fa3a8;
    font-size: 0.9rem;
}

.location-search-result-item:last-child {
    border-bottom: none;
}

.location-search-result-item:hover {
    background-color: #2a2a29;
    color: #e9ecef;
}

.location-search-result-address {
    display: block;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.location-search-result-distance {
    display: block;
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 0.25rem;
}

.location-search-no-results {
    padding: 1rem;
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
}

/* ============================================
   INFO & STATUS MESSAGES
   ============================================ */

.location-info-banner {
    background-color: #e3f2fd;
    border-left: 4px solid #4a6cf7;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    color: #1565c0;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.location-error-banner {
    background-color: #ffebee;
    border-left: 4px solid #ff6b6b;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    color: #c62828;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.location-success-banner {
    background-color: #e8f5e9;
    border-left: 4px solid #51cf66;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    color: #2e7d32;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.location-error-close {
    margin-left: auto;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.location-error-close:hover {
    opacity: 1;
}

/* ============================================
   LOCATION DETAILS CARD
   ============================================ */

.location-details-card {
    background-color: #1a1a19;
    border: 1px solid #9fa3a8;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    color: #9fa3a8;
}

.location-details-title {
    font-weight: 600;
    color: #e9ecef;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.location-coordinate {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #333;
    font-size: 0.9rem;
}

.location-coordinate:last-child {
    border-bottom: none;
}

.location-coordinate-label {
    font-weight: 500;
    color: #4a6cf7;
}

.location-coordinate-value {
    font-family: 'Courier New', monospace;
    color: #e9ecef;
}

/* ============================================
   DELIVERY FORM INTEGRATION
   ============================================ */

.map-based-delivery-section {
    background-color: #0e0e0d;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.map-based-delivery-title {
    color: #e9ecef;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.delivery-location-button {
    width: 100%;
    padding: 0.75rem;
    background-color: #4a6cf7;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.delivery-location-button:hover {
    background-color: #2d4ba8;
    box-shadow: 0 4px 12px rgba(74, 108, 247, 0.3);
}

.delivery-location-button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes pulse-marker {
    0% {
        box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
    }
    50% {
        box-shadow: 0 2px 8px rgba(255, 107, 107, 0.6);
    }
    100% {
        box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.location-search-btn.loading::before {
    content: '⌛';
    display: inline-block;
    animation: spin 1s linear infinite;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    #locationMapContainer {
        height: 300px;
        margin-bottom: 1rem;
    }

    .location-search-input-group {
        flex-direction: column;
    }

    .location-search-btn {
        width: 100%;
        justify-content: center;
    }

    .map-based-delivery-section {
        padding: 1rem;
    }

    .location-search-results {
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    #locationMapContainer {
        height: 250px;
    }

    .location-search-input {
        font-size: 14px;
        padding: 0.5rem 0.75rem;
    }

    .location-search-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .location-details-card {
        font-size: 0.85rem;
    }

    .location-coordinate {
        font-size: 0.8rem;
    }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

@media (prefers-color-scheme: dark) {
    .leaflet-control-zoom-in,
    .leaflet-control-zoom-out {
        background-color: #1a1a19 !important;
        color: #4a6cf7 !important;
        border: 1px solid #9fa3a8 !important;
    }

    .leaflet-control-zoom-in:hover,
    .leaflet-control-zoom-out:hover {
        background-color: #2a2a29 !important;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.location-search-input:focus-visible,
.location-search-btn:focus-visible,
.location-search-result-item:focus-visible {
    outline: 2px solid #4a6cf7;
    outline-offset: 2px;
}

/* Keyboard navigation support */
.location-search-result-item:focus-visible {
    background-color: #2a2a29;
    color: #e9ecef;
}
