/* ============================================
   INTIME ASSIST - LOCATION PICKER STYLES
   ============================================ */

/* Main Container */
.location-picker {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.location-picker-header {
    padding: 0.875rem 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-default);
}

.location-picker-header h4 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.location-picker-header h4 i {
    color: var(--color-error);
    font-size: 1rem;
}

/* Search Container */
.location-search-container {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-default);
    position: relative;
}

.location-search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 0 1rem;
    transition: all 0.2s ease;
}

.location-search-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.location-search-input-wrapper > i {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.location-search-input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.875rem 0;
    font-size: 0.9375rem;
}

.location-search-input-wrapper input:focus {
    outline: none;
    box-shadow: none;
}

/* GPS Button */
.location-gps-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.location-gps-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.location-gps-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Search Results */
.location-search-results {
    position: absolute;
    top: calc(100% - 0.5rem);
    left: 1.25rem;
    right: 1.25rem;
    background: white;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.location-search-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--border-light);
}

.location-search-item:last-child {
    border-bottom: none;
}

.location-search-item:hover {
    background: var(--bg-secondary);
}

.location-search-item > i {
    color: var(--primary);
    font-size: 1rem;
    margin-top: 0.125rem;
    flex-shrink: 0;
}

.location-search-item-text {
    flex: 1;
    min-width: 0;
}

.location-search-item-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.location-search-item-address {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.location-search-loading,
.location-search-empty,
.location-search-error {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.location-search-error {
    color: var(--color-error);
}

/* Map Container */
.location-map-container {
    position: relative;
}

.location-map {
    height: 250px;
    width: 100%;
    background: var(--bg-tertiary);
}

.location-map-hint {
    position: absolute;
    bottom: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 500;
    pointer-events: none;
}

/* Custom Marker */
.custom-marker {
    background: none;
    border: none;
}

.custom-marker i {
    font-size: 2rem;
    color: var(--primary);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Selected Location */
.location-selected {
    padding: 1rem 1.25rem;
    background: var(--color-success-light);
    border-top: 1px solid var(--color-success);
}

.location-selected-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--color-success);
    font-weight: 600;
    font-size: 0.875rem;
}

.location-selected-header i {
    font-size: 1rem;
}

.location-selected-address {
    font-size: 0.9375rem;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 0.25rem;
}

.location-selected-coords {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'Monaco', 'Consolas', monospace;
}

/* Responsive */
@media (max-width: 768px) {
    .location-picker-header {
        padding: 0.875rem 1rem;
    }

    .location-picker-header h4 {
        font-size: 0.9375rem;
    }

    .location-search-container {
        padding: 0.875rem 1rem;
    }

    .location-map {
        height: 200px;
    }

    .location-search-results {
        left: 1rem;
        right: 1rem;
    }

    .location-selected {
        padding: 0.875rem 1rem;
    }
}

/* Leaflet Overrides */
.leaflet-container {
    font-family: inherit;
}

.leaflet-control-attribution {
    font-size: 0.625rem;
}

.leaflet-popup-content {
    font-size: 0.875rem;
}

/* Modal Specific */
.checkout-modal .location-picker {
    margin-top: 0.5rem;
}

/* ============================================
   DELIVERY SECTION
   ============================================ */

.delivery-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.delivery-section .section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-default);
}

.delivery-section .section-title i {
    color: var(--primary);
}

/* Saved Address Card */
.saved-address-section {
    margin-bottom: 1rem;
}

.saved-address-card {
    background: var(--color-success-light);
    border: 1px solid var(--color-success);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.saved-address-info {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    flex: 1;
}

.saved-address-info > i {
    color: var(--color-success);
    font-size: 1.25rem;
    margin-top: 0.125rem;
}

.saved-address-text {
    font-size: 0.9375rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.saved-address-text strong {
    display: block;
    margin-bottom: 0.25rem;
}

.saved-address-text .address-details {
    color: var(--text-muted);
    font-size: 0.875rem;
}

#changeAddressBtn {
    flex-shrink: 0;
}

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--primary);
    cursor: pointer;
}

.checkbox-text {
    line-height: 1.4;
}

/* Hidden state for location picker when using saved address */
.location-picker-hidden {
    display: none !important;
}

/* Success Button State */
.btn-success,
.btn.btn-success {
    background: var(--color-success) !important;
    border-color: var(--color-success) !important;
    color: white !important;
}

.btn-success:hover {
    background: var(--color-success) !important;
    opacity: 0.9;
}

/* Responsive */
@media (max-width: 480px) {
    .saved-address-actions {
        flex-direction: column;
    }

    .saved-address-actions .btn {
        width: 100%;
    }
}
