/**
 * Location Permission Modal & Component Styles
 * Beautiful, modern design for location-based features
 */

/* ============================================
   Location Permission Modal
   ============================================ */

.location-modal-content {
    border: none;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
}

.modal-top-gradient {
    height: 6px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #a855f7);
}

.location-icon-wrapper {
    display: inline-block;
}

.location-icon-bg {
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.15));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    animation: pulse-location 2s infinite;
}

.location-icon-bg i {
    font-size: 40px;
    color: #6366f1;
}

@keyframes pulse-location {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 15px rgba(99, 102, 241, 0);
    }
}

.location-benefit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #047857;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
}

.location-benefit i {
    color: #10b981;
}

.privacy-note {
    opacity: 0.7;
    font-size: 12px !important;
}

.privacy-note i {
    color: #6366f1;
}

/* Modal buttons */
#locationAllowBtn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    transition: all 0.3s ease;
}

#locationAllowBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

#locationDenyBtn {
    transition: all 0.3s ease;
}

#locationDenyBtn:hover {
    background: #f3f4f6;
}

/* ============================================
   Section Main Title with Badge
   ============================================ */

.section-main-title {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 15px;
}

.section-subtitle {
    color: #6b7280;
    font-size: 16px;
    max-width: 600px;
    margin: 0 auto 10px;
    line-height: 1.6;
}

.location-toggle-wrapper {
    display: flex;
    justify-content: center;
}

/* ============================================
   Location Status Badge
   ============================================ */

.location-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff !important;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    vertical-align: middle;
}

.location-status-badge * {
    color: #ffffff !important;
}

.location-status-badge.global {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.location-status-badge.active {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff !important;
}

.location-status-badge i {
    font-size: 14px;
    color: #ffffff !important;
}

.location-status-badge span {
    color: #ffffff !important;
}

/* ============================================
   Location Toggle Button
   ============================================ */

.location-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
    border: 1px dashed rgba(99, 102, 241, 0.4);
    border-radius: 10px;
    color: #6366f1;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.location-toggle-btn:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
    border-color: #6366f1;
    transform: translateY(-2px);
    color: #6366f1;
}

.location-toggle-btn i {
    font-size: 16px;
}

/* ============================================
   Section Header with Location
   ============================================ */

.section-header-location {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 25px;
}

.section-header-location h5 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
}

.section-header-location .view-all-btn {
    font-size: 14px;
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.section-header-location .view-all-btn:hover {
    color: #4f46e5;
    transform: translateX(5px);
}

/* ============================================
   Nearby Items Section
   ============================================ */

.nearby-items-section {
    position: relative;
}

.nearby-items-empty {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 20px;
}

.nearby-items-empty i {
    font-size: 60px;
    color: #cbd5e1;
    margin-bottom: 20px;
}

.nearby-items-empty h4 {
    font-size: 20px;
    color: #475569;
    margin-bottom: 10px;
}

.nearby-items-empty p {
    color: #94a3b8;
    margin-bottom: 20px;
}

/* ============================================
   Distance Badge on Items
   ============================================ */

.item-distance-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
    backdrop-filter: blur(5px);
}

.item-distance-badge i {
    color: #10b981;
    font-size: 11px;
}

/* ============================================
   Location Filter in Product Page
   ============================================ */

.location-filter-box {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 16px;
    padding: 20px;
    margin-top: 20px;
}

.location-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.location-filter-header h6 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #374151;
}

.location-filter-header h6 i {
    color: #6366f1;
}

.location-radius-slider {
    width: 100%;
}

.location-radius-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.radius-option {
    padding: 8px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 13px;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.3s ease;
}

.radius-option:hover {
    border-color: #6366f1;
    color: #6366f1;
}

.radius-option.active {
    background: #6366f1;
    border-color: #6366f1;
    color: white;
}

/* ============================================
   Responsive Styles
   ============================================ */

@media (max-width: 768px) {
    .location-modal-content {
        margin: 15px;
        border-radius: 16px;
    }

    .location-icon-bg {
        width: 70px;
        height: 70px;
    }

    .location-icon-bg i {
        font-size: 30px;
    }

    .section-header-location {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-header-location h5 {
        font-size: 18px;
    }

    .location-toggle-btn {
        width: 100%;
        justify-content: center;
    }

    .location-status-badge {
        padding: 5px 10px;
        font-size: 12px;
    }
}

/* ============================================
   Animation Classes
   ============================================ */

.fade-in-up {
    animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-left {
    animation: slideInLeft 0.4s ease forwards;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   Google Maps Display Styles
   ============================================ */

.item-map-container {
    width: 100%;
    height: 300px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

.item-map-container.large {
    height: 400px;
}

.item-map-container.small {
    height: 200px;
}

.map-no-location {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    color: #94a3b8;
}

.map-no-location i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.map-no-location p {
    font-size: 14px;
    margin: 0;
}

.map-info-window {
    padding: 10px;
    min-width: 150px;
}

.map-info-window h6 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: #1f2937;
}

.map-info-window p {
    font-size: 12px;
    margin: 0;
    color: #6b7280;
}

.map-info-window i {
    color: #6366f1;
    margin-right: 5px;
}

/* ============================================
   Address Autocomplete Input Styles
   ============================================ */

.location-input-wrapper {
    position: relative;
}

.location-input-wrapper input {
    padding-right: 45px;
}

.location-input-wrapper .location-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #6366f1;
    cursor: pointer;
    transition: color 0.3s;
}

.location-input-wrapper .location-icon:hover {
    color: #4f46e5;
}

.location-input-wrapper .location-icon.loading {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: translateY(-50%) rotate(0deg);
    }

    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

.location-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    border-radius: 10px;
    margin-top: 10px;
    font-size: 13px;
    color: #047857;
}

.location-preview i {
    font-size: 16px;
}

.location-preview .coords {
    font-size: 11px;
    opacity: 0.8;
    margin-left: auto;
}

/* Map in Product Detail */
.product-location-map {
    margin-top: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.product-location-map h5 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.product-location-map h5 i {
    color: #6366f1;
}

/* Responsive */
@media (max-width: 768px) {
    .item-map-container {
        height: 250px;
    }

    .item-map-container.large {
        height: 300px;
    }
}

/* ============================================
   Location Form Select Dropdowns
   ============================================ */

.upload_form_input .form-select {
    width: 100%;
    height: 55px;
    padding: 10px 40px 10px 20px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    color: #374151;
    background-color: #fff;
    transition: all 0.3s ease;
    cursor: pointer;
    /* Remove native arrow */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* Custom single arrow */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8.5L1 3.5h10L6 8.5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 12px;
}

.upload_form_input .form-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.upload_form_input .form-select:disabled {
    background-color: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}

.upload_form_input .form-select option {
    padding: 10px;
    font-size: 14px;
}

/* Loading state for dropdowns */
.upload_form_input .form-select option[value=""] {
    color: #9ca3af;
}

/* Location Select Wrapper */
.location-select-wrapper {
    position: relative;
    display: block;
    margin-bottom: 0;
    transition: margin-bottom 0.3s ease;
}

/* Add space below when loading */
.location-select-wrapper.loading {
    margin-bottom: 25px;
}

/* Loading Spinner - Below the select box (visible during loading) */
.location-select-wrapper .loading-spinner {
    position: absolute;
    left: 0;
    bottom: -25px;
    width: 18px;
    height: 18px;
    display: none;
    z-index: 10;
    pointer-events: none;
}

.location-select-wrapper.loading .loading-spinner {
    display: block !important;
}

/* Loading state - Override ALL blue/purple colors */
.location-select-wrapper.loading .form-select,
.location-select-wrapper.loading .form-select:focus,
.location-select-wrapper.loading .form-select:active,
.location-select-wrapper.loading .form-select:hover,
.location-select-wrapper.loading .form-select:visited,
.upload_form_input .location-select-wrapper.loading .form-select,
.upload_form_input .location-select-wrapper.loading .form-select:focus,
.upload_form_input .location-select-wrapper.loading .form-select:active,
.upload_form_input .location-select-wrapper.loading .form-select:hover {
    padding-right: 70px !important;
    color: #9ca3af !important;
    pointer-events: none !important;
    border: 1px solid #d1d5db !important;
    border-color: #d1d5db !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
    -moz-box-shadow: none !important;
    background-color: #f9fafb !important;
    outline: 0 !important;
    outline-color: transparent !important;
    outline-style: none !important;
    outline-width: 0 !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

/* Remove focus ring completely during loading */
.location-select-wrapper.loading .form-select::-moz-focus-inner {
    border: 0 !important;
}

/* Circular Loading Spinner - GRAY ONLY - Displayed below dropdown */
.spinner-circle {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    max-width: 18px;
    max-height: 18px;
    border: 2px solid #e5e7eb;
    border-top-color: #6b7280;
    border-radius: 50%;
    animation: spinLoader 0.8s linear infinite;
    box-sizing: border-box;
    flex-shrink: 0;
}

@keyframes spinLoader {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Extra override for any nice-select or other plugins */
.location-select-wrapper.loading * {
    outline: none !important;
    box-shadow: none !important;
}

/* ============================================
   Google Places Autocomplete Styles
   ============================================ */

.autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.autocomplete-wrapper input {
    width: 100%;
    padding-right: 120px;
}

.autocomplete-hint {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 500;
    display: none;
    pointer-events: none;
    animation: pulse-hint 2s infinite;
}

.autocomplete-hint i {
    margin-right: 4px;
}

@keyframes pulse-hint {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Enhanced Google Autocomplete Dropdown */
.pac-container {
    border-radius: 12px !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
    margin-top: 8px !important;
    font-family: inherit !important;
    z-index: 9999 !important;
    background: white !important;
    overflow: hidden !important;
}

.pac-item {
    padding: 12px 16px !important;
    font-size: 14px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    border-bottom: 1px solid #f3f4f6 !important;
    display: flex !important;
    align-items: center !important;
}

.pac-item:last-child {
    border-bottom: none !important;
}

.pac-item:hover {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%) !important;
}

.pac-item-selected,
.pac-item-selected:hover {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%) !important;
}

.pac-icon {
    margin-right: 12px !important;
    width: 20px !important;
    height: 20px !important;
    background-size: contain !important;
}

.pac-item-query {
    font-weight: 600 !important;
    color: #1f2937 !important;
    font-size: 14px !important;
}

.pac-matched {
    color: #4f46e5 !important;
    font-weight: 700 !important;
}

/* Hide Google branding */
.pac-logo::after {
    display: none !important;
}

/* Responsive styles */
@media (max-width: 576px) {
    .autocomplete-hint {
        padding: 3px 8px;
        font-size: 10px;
    }

    .autocomplete-wrapper input {
        padding-right: 100px;
    }

    .pac-item {
        padding: 10px 12px !important;
        font-size: 13px !important;
    }
}

/* ============================================
   Distance Slider Styles
   ============================================ */

.location-filter-section {
    margin-top: 1.5rem;
}

.location-filter-box {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px 25px;
    transition: all 0.3s ease;
}

.location-filter-box:hover {
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.1);
    border-color: #c7d2fe;
}

.location-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.location-filter-header h6 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.location-filter-header h6 i {
    color: #6366f1;
}

.location-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    background: #f1f5f9;
    color: #64748b;
    transition: all 0.3s ease;
}

.location-status-badge.active {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #16a34a;
}

.location-status-badge.active i {
    color: #16a34a;
}

/* Distance Slider Wrapper */
.distance-slider-wrapper {
    padding: 10px 0 5px;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 12px;
    color: #94a3b8;
}

.slider-labels .current-distance {
    font-size: 18px;
    font-weight: 700;
    color: #6366f1;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    padding: 6px 16px;
    border-radius: 20px;
    min-width: 80px;
    text-align: center;
}

/* Custom Range Slider */
.distance-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 10px;
    background: linear-gradient(90deg, #c7d2fe 0%, #a5b4fc 50%, #818cf8 100%);
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.distance-slider:hover {
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

/* Slider thumb - WebKit */
.distance-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    transition: all 0.2s ease;
}

.distance-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.distance-slider::-webkit-slider-thumb:active {
    transform: scale(1.1);
}

/* Slider thumb - Firefox */
.distance-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    transition: all 0.2s ease;
}

.distance-slider::-moz-range-thumb:hover {
    transform: scale(1.15);
}

/* Slider track - Firefox */
.distance-slider::-moz-range-track {
    height: 8px;
    border-radius: 10px;
    background: linear-gradient(90deg, #c7d2fe 0%, #a5b4fc 50%, #818cf8 100%);
}

/* Slider markers */
.slider-markers {
    display: flex;
    justify-content: space-between;
    padding: 8px 5px 0;
}

.slider-markers span {
    font-size: 11px;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.slider-markers span:hover {
    color: #6366f1;
    background: #eef2ff;
}

/* Location Action Buttons */
.location-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-location-enable {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-location-enable:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-location-enable:active {
    transform: translateY(0);
}

.btn-location-disable {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-location-disable:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
}

/* Location enabled state */
.location-filter-box.location-enabled {
    border-color: #86efac;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.location-filter-box.location-enabled .distance-slider {
    background: linear-gradient(90deg, #86efac 0%, #4ade80 50%, #22c55e 100%);
}

.location-filter-box.location-enabled .slider-labels .current-distance {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #16a34a;
}

/* Responsive */
@media (max-width: 576px) {
    .location-filter-box {
        padding: 15px;
    }

    .location-filter-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .slider-labels .current-distance {
        font-size: 16px;
        padding: 4px 12px;
    }

    .btn-location-enable,
    .btn-location-disable {
        width: 100%;
        justify-content: center;
    }
}