/**
 * Facebook Marketplace Style Location Feature
 * Modern, clean design with Google Maps integration
 */

/* ============================================
   Location Badge (Top Right Corner)
   ============================================ */

.fb-location-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #e4e6eb;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    color: #1877f2;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.fb-location-badge:hover {
    background: #f0f2f5;
    border-color: #1877f2;
    box-shadow: 0 2px 8px rgba(24, 119, 242, 0.15);
}

.fb-location-badge i {
    color: #1877f2;
    font-size: 14px;
}

.fb-location-badge .location-text {
    color: #1877f2;
    font-weight: 500;
}

.fb-location-badge .location-radius {
    color: #65676b;
    font-weight: 400;
}

/* Section Header with Location Badge */
.section-header-with-location {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 25px;
}

.section-header-with-location h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #1c1e21;
}

/* ============================================
   Location Modal (Facebook Style)
   ============================================ */

.fb-location-modal .modal-dialog {
    max-width: 520px;
}

.fb-location-modal .modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 12px 28px 0 rgba(0, 0, 0, 0.2), 0 2px 4px 0 rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.fb-location-modal .modal-header {
    background: #ffffff;
    border-bottom: 1px solid #e4e6eb;
    padding: 16px 16px 16px 20px;
    position: relative;
}

.fb-location-modal .modal-title {
    font-size: 20px;
    font-weight: 700;
    color: #1c1e21;
    text-align: center;
    flex: 1;
}

.fb-location-modal .modal-header .btn-close {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: #e4e6eb;
    border-radius: 50%;
    opacity: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    padding: 0;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: #65676b;
    line-height: 1;
}

.fb-location-modal .modal-header .btn-close::before {
    content: '\00d7';
    font-size: 24px;
    font-weight: 300;
    color: #65676b;
}

.fb-location-modal .modal-header .btn-close:hover {
    background: #d8dadf;
}

.fb-location-modal .modal-header .btn-close:hover::before {
    color: #1c1e21;
}

.fb-location-modal .modal-body {
    padding: 16px 20px;
    background: #ffffff;
}

.fb-location-modal .modal-subtitle {
    font-size: 14px;
    color: #65676b;
    margin-bottom: 16px;
}

/* Location Search Input */
.fb-location-input-wrapper {
    position: relative;
    margin-bottom: 16px;
}

.fb-location-input-wrapper .location-icon {
    position: absolute;
    left: 14px;
    top: 20px;
    color: #1877f2;
    font-size: 16px;
    z-index: 2;
}

.fb-location-input-wrapper input {
    width: 100%;
    height: 56px;
    padding: 22px 16px 8px 44px;
    border: 1px solid #e4e6eb;
    border-radius: 8px;
    font-size: 15px;
    color: #1c1e21;
    background: #f0f2f5;
    transition: all 0.2s ease;
}

.fb-location-input-wrapper input:focus {
    outline: none;
    border-color: #1877f2;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.2);
}

.fb-location-input-wrapper input::placeholder {
    color: #8a8d91;
}

.fb-location-input-wrapper label {
    position: absolute;
    left: 44px;
    top: 10px;
    font-size: 11px;
    color: #8a8d91;
    pointer-events: none;
    z-index: 1;
}

/* Radius Dropdown */
.fb-radius-wrapper {
    margin-bottom: 16px;
}

.fb-radius-wrapper label {
    display: block;
    font-size: 11px;
    color: #8a8d91;
    margin-bottom: 4px;
    padding-left: 4px;
}

.fb-radius-select {
    width: 100%;
    height: 52px;
    padding: 12px 40px 12px 16px;
    border: 1px solid #e4e6eb;
    border-radius: 8px;
    font-size: 15px;
    color: #1c1e21;
    background: #f0f2f5;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2365676b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    transition: all 0.2s ease;
}

.fb-radius-select:focus {
    outline: none;
    border-color: #1877f2;
    background-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.2);
}

/* Map Container */
.fb-map-container {
    width: 100%;
    height: 280px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
    border: 1px solid #e4e6eb;
    position: relative;
    background: #f0f2f5;
}

.fb-map-container #locationPickerMap {
    width: 100%;
    height: 100%;
}

/* Current Location Button on Map */
.fb-current-location-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    background: #ffffff;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.fb-current-location-btn:hover {
    background: #f0f2f5;
}

.fb-current-location-btn i {
    color: #1c1e21;
    font-size: 18px;
}

.fb-current-location-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Modal Footer */
.fb-location-modal .modal-footer {
    padding: 12px 20px 20px;
    border-top: none;
    background: #ffffff;
}

.fb-apply-btn {
    width: 100%;
    height: 44px;
    background: #1877f2;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fb-apply-btn:hover {
    background: #166fe5;
}

.fb-apply-btn:disabled {
    background: #e4e6eb;
    color: #bcc0c4;
    cursor: not-allowed;
}

/* ============================================
   Item Cards with Location
   ============================================ */

.item-location-text {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #65676b;
    margin-top: 4px;
}

.item-location-text i {
    font-size: 11px;
    color: #8a8d91;
}

/* ============================================
   Google Places Autocomplete Styling
   ============================================ */

.pac-container {
    border-radius: 8px !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    margin-top: 4px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
    z-index: 10000 !important;
}

.pac-item {
    padding: 10px 14px !important;
    font-size: 14px !important;
    cursor: pointer !important;
    transition: background 0.15s ease !important;
    border-top: 1px solid #f0f2f5 !important;
}

.pac-item:first-child {
    border-top: none !important;
}

.pac-item:hover {
    background: #f0f2f5 !important;
}

.pac-item-selected {
    background: #e7f3ff !important;
}

.pac-icon {
    margin-right: 10px !important;
}

.pac-matched {
    font-weight: 600 !important;
}

/* ============================================
   Loading States
   ============================================ */

.fb-location-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 280px;
    background: #f0f2f5;
    border-radius: 12px;
}

.fb-location-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e4e6eb;
    border-top-color: #1877f2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   Responsive Styles
   ============================================ */

@media (max-width: 576px) {
    .fb-location-modal .modal-dialog {
        margin: 0.5rem;
    }

    .fb-location-modal .modal-content {
        border-radius: 16px 16px 0 0;
    }

    .fb-map-container {
        height: 220px;
    }

    .fb-location-badge {
        padding: 6px 12px;
        font-size: 13px;
    }

    .section-header-with-location {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============================================
   No Location State
   ============================================ */

.fb-no-location {
    text-align: center;
    padding: 40px 20px;
    background: #f0f2f5;
    border-radius: 12px;
}

.fb-no-location i {
    font-size: 48px;
    color: #8a8d91;
    margin-bottom: 16px;
}

.fb-no-location h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1c1e21;
    margin-bottom: 8px;
}

.fb-no-location p {
    font-size: 14px;
    color: #65676b;
    margin-bottom: 16px;
}

.fb-enable-location-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #1877f2;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fb-enable-location-btn:hover {
    background: #166fe5;
}

/* ============================================
   Map Circle Overlay
   ============================================ */

.gm-style .gm-style-iw-c {
    border-radius: 12px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.gm-style .gm-style-iw-d {
    overflow: hidden !important;
}

/* Custom Map Controls */
.fb-map-zoom-controls {
    position: absolute;
    right: 12px;
    bottom: 120px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    z-index: 10;
}

.fb-map-zoom-btn {
    width: 40px;
    height: 40px;
    background: #ffffff;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.fb-map-zoom-btn:first-child {
    border-radius: 8px 8px 0 0;
}

.fb-map-zoom-btn:last-child {
    border-radius: 0 0 8px 8px;
}

.fb-map-zoom-btn:hover {
    background: #f0f2f5;
}

.fb-map-zoom-btn i {
    color: #1c1e21;
    font-size: 16px;
}